Ludic numbers: Difference between revisions
Content added Content deleted
m (Update output) |
m (→{{header|Haskell}}: concat . map -> concatMap, (and dropped a couple of redundant $)) |
||
Line 1,467: | Line 1,467: | ||
ludic :: [Integer] |
ludic :: [Integer] |
||
ludic = 1 : unfoldr (\xs@(x:_) -> Just (x, dropEvery x xs)) [2..] |
ludic = 1 : unfoldr (\xs@(x:_) -> Just (x, dropEvery x xs)) [2 ..] |
||
where |
|||
dropEvery n = |
dropEvery n = concatMap tail . unfoldr (Just . genericSplitAt n) |
||
main :: IO () |
main :: IO () |
||
main = do |
main = do |
||
print $ take 25 |
print $ take 25 ludic |
||
print |
(print . length) $ takeWhile (<= 1000) ludic |
||
print $ take 6 $ drop 1999 |
print $ take 6 $ drop 1999 ludic |
||
-- haven't done triplets task yet</lang> |
|||
{{out}} |
{{out}} |
||
<pre> |
<pre> |