numdiv records

"Ruud H.G. van Tol" <[email protected]> Mon, 25 May 2026 18:38:32 +0200
Newsgroups gmane.comp.mathematics.pari.user
Message-ID <[email protected]>
oeis:A00218 lists numdiv-records:

first(nn)= {
   my(n=0, r=0, s=1, t);
   vector
   ( nn
   , i
   , while( (t=numdiv(n+=s)) <= r, );
     2==s || n<10 || s=2;
     r=t
   );
}

How to do this more efficiently?

https://oeis.org/A002183 has a b-file of 10k values,
but first(60) already takes over a minute.

See also https://wwwhomes.uni-bielefeld.de/achim/HCN/

-- Ruud