September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -1,18 +1,20 @@
fact :: [Integer]
fact = scanl (*) 1 [1..]
fact = scanl (*) 1 [1 ..]
leftFact :: [Integer]
leftFact = scanl (+) 0 fact
main = do
putStrLn "0 ~ 10:"
putStrLn $ show $ map (\n -> leftFact !! n) [0..10]
putStrLn ""
putStrLn "20 ~ 110 by tens:"
putStrLn $ unlines $ map show $ map (\n -> leftFact !! n) [20,30..110]
putStrLn ""
putStrLn "length of 1,000 ~ 10,000 by thousands:"
putStrLn $ show $ map (\n -> length $ show $ leftFact !! n) [1000,2000..10000]
putStrLn ""
main :: IO ()
main =
mapM_
putStrLn
[ "0 ~ 10:"
, show $ (leftFact !!) <$> [0 .. 10]
, ""
, "20 ~ 110 by tens:"
, unlines $ show . (leftFact !!) <$> [20,30 .. 110]
, ""
, "length of 1,000 ~ 10,000 by thousands:"
, show $ (length . show . (leftFact !!)) <$> [1000,2000 .. 10000]
, ""
]