Anonymous user
Sequence: smallest number greater than previous term with exactly n divisors: Difference between revisions
Sequence: smallest number greater than previous term with exactly n divisors (view source)
Revision as of 15:20, 16 July 2020
, 3 years ago→{{header|Haskell}}
Line 306:
countDivs n = foldr f 0 [1..floor (sqrt $ realToFrac n)]
where
f d r | n `mod` d == 0 = let y = n `div` d in if d == y then
| otherwise = r
go t ((n,d):xs) | d == t = (t,n):go (succ t) xs
| otherwise = go t xs
|