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