Jump to content

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

m
Line 306:
sequence_A069654 = go 1 nDivCount
where
nDivCount = (,) <*> divisorCountlength . nub . divisors <$> [1..]
divisors n = [1..ceiling (sqrt $ realToFrac n)] >>= \x ->
divisorCount = length . nub . divisors
guard (n `mod` x == 0) >> [x, n `div` x]
where
divisors n = [1..ceiling (sqrt $ realToFrac n)] >>= \x ->
guard (n `mod` x == 0) >> [x, n `div` x]
go t ((n,d):xs)
| d == t = (t,n):go (succ t) xs
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.