Jump to content

Sequence: smallest number greater than previous term with exactly n divisors: Difference between revisions

m
Line 306:
countDivisors n = foldr f 0 [1..floor (sqrt $ realToFrac n)]
where
f dx r | n `mod` dx == 0 = let y = n `div` dx in if dx == y then r+1 else r+2
| otherwise = r
go t ((n,dc):xs) | dc == t = (t,n):go (succ t) xs
| otherwise = go t xs
 
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.