Anonymous user
Increasing gaps between consecutive Niven numbers: Difference between revisions
Increasing gaps between consecutive Niven numbers (view source)
Revision as of 13:02, 26 April 2020
, 4 years ago→{{header|Haskell}}
Line 224:
nivens :: [Int]
nivens = [1..] >>= \n -> guard (n `rem` digitSum n == 0) >>
where
digitSum = sum . unfoldr (\x -> guard (x > 0) >> pure (swap $ x `quotRem` 10))
|