Data update

This commit is contained in:
Ingy döt Net 2023-07-22 21:42:12 -07:00
parent 9817d9b99b
commit 07c7092a52
140 changed files with 2712 additions and 241 deletions

View file

@ -0,0 +1,29 @@
import Data.Numbers.Primes
import Data.List (group, intercalate, transpose)
import Data.List.Split (chunksOf)
import Text.Printf
----------------------- OEISA000005 ----------------------
oeisA000005 :: [Int]
oeisA000005 = tau <$> [1..]
tau :: Integer -> Int
tau = product . fmap (succ . length) . group . primeFactors
--------------------------- TEST -------------------------
main :: IO ()
main = putStrLn $
(table " " . chunksOf 10 . fmap show . take 100)
oeisA000005
------------------------ FORMATTING ----------------------
table :: String -> [[String]] -> String
table gap rows =
let ws = maximum . fmap length <$> transpose rows
pw = printf . flip intercalate ["%", "s"] . show
in unlines $ intercalate gap . zipWith pw ws <$> rows