Sequence: nth number with exactly n divisors: Difference between revisions

m
Line 423:
n <- [1..30] :: [Integer]
if isPrime n then
pure (n, unPrime (nthPrime (fromIntegral n)) ^ (n - 1))
else
pure (n, f n)
where
f n = fst (havingNthDivisors n !! pred (fromIntegral n))
nthPrime n = unPrime (toEnum n :: Prime Integer)
 
main :: IO ()
Anonymous user