Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,25 @@
import Data.List (intercalate)
--------------------- BABBAGE PROBLEM --------------------
babbagePairs :: [[Integer]]
babbagePairs =
[0, 1000000 ..]
>>= \x -> -- Drawing from a succession of N * 10^6
let y = (x + 269696) -- The next number ending in 269696,
r = root y -- its square root,
i = floor r -- and the integer part of that root.
in [ [i, y] -- Root and square harvested together,
| r == fromIntegral i -- only if that root is an integer.
]
root :: Integer -> Double
root = sqrt. fromIntegral
--------------------------- TEST -------------------------
main :: IO ()
main = mapM_ (putStrLn . arrowed) $ take 10 babbagePairs
arrowed :: [Integer] -> String
arrowed = intercalate " ^ 2 -> " . fmap show