Increasing gaps between consecutive Niven numbers: Difference between revisions
Content deleted Content added
Line 221: | Line 221: | ||
import Data.List (intercalate, unfoldr) |
import Data.List (intercalate, unfoldr) |
||
import Data.List.Split (chunksOf) |
import Data.List.Split (chunksOf) |
||
import Data.Tuple (swap) |
|||
nivens :: [Int] |
nivens :: [Int] |
||
Line 228: | Line 229: | ||
pure n |
pure n |
||
where |
where |
||
digitSum = sum . unfoldr (\x -> guard (x > 0) >> pure ( |
digitSum = sum . unfoldr (\x -> guard (x > 0) >> pure (swap $ x `quotRem` 10)) |
||
findGaps :: [(Int, Int, Int)] |
findGaps :: [(Int, Int, Int)] |