OFFSET
1,2
COMMENTS
From Jon E. Schoenfield, Apr 30 2022: (Start)
This sequence includes all noncomposite numbers, the squares of all odd primes, and the cube of every odd prime p such that p^3 - 2 is composite.
It also includes every number k of the form p*q, with p and q distinct primes, such that k-2 is composite and k-1 is neither a prime nor the square of a prime.
In general, it includes every number k such that tau(k-j) > tau(k) - j for each j in 1..tau(k)-1.
Terms with larger numbers of divisors occur less frequently. The first terms with 0, 1, 2, 3, and 4 distinct prime factors are 1, 3, 22, 2110, and 17585778, respectively (each of which is squarefree). What is the first term with 5 distinct prime factors?
(End)
LINKS
Johan Lindgren, Table of n, a(n) for n = 1..10000
MATHEMATICA
s = {}; fm = -1; Do[f = n - DivisorSigma[0, n]; If[f > fm, fm = f; AppendTo[s, n]], {n, 1, 120}]; s (* Amiram Eldar, Apr 25 2022 *)
PROG
(C++)
int main() {
int kMax = 500, kRecord = -1;
for ( int k = 1; k < kMax; k++) {
int nonDivisorCount = 0;
for ( int d = 2; d < k; d++ ) { nonDivisorCount += (k % d != 0); }
if ( nonDivisorCount > kRecord ) {
kRecord = nonDivisorCount;
cout << k << "\n";
}
}
return 0;
}
(PARI) f(n) = n - numdiv(n); \\ A049820
lista(nn) = {my(m=-oo, list=List(), fn); for (n=1, nn, if ((fn=f(n)) > m, listput(list, n); m = fn; ); ); Vec(list); } \\ Michel Marcus, Apr 25 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Johan Lindgren, Apr 24 2022
STATUS
approved