Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,21 @@
import Data.Char
pairs :: [a] -> [(a,a)]
pairs (a:b:as) = (a,b):pairs (b:as)
pairs _ = []
riseEqFall :: Int -> Bool
riseEqFall n = rel (>) digitPairs == rel (<) digitPairs
where rel r = sum . map (fromEnum . uncurry r)
digitPairs = pairs $ map digitToInt $ show n
a296712 :: [Int]
a296712 = [n | n <- [1..], riseEqFall n]
main :: IO ()
main = do
putStrLn "The first 200 numbers are: "
putStrLn $ unwords $ map show $ take 200 a296712
putStrLn ""
putStr "The 10,000,000th number is: "
putStrLn $ show $ a296712 !! 9999999