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 14:23, 16 July 2020
, 3 years ago→{{header|Haskell}}
Line 301:
<lang haskell>import Data.List (nub)
import Text.Printf (printf)
import Control.Monad (guard)
sequence_A069654 :: [(Int,Int)]
Line 306 ⟶ 307:
where
nDivCount = (,) <*> divisorCount <$> [1..]
divisorCount = length . nub
where
divisors n = [1..ceiling (
go t ((n,d):xs)
| d == t = (t,n):go (succ t) xs
|