login
A396771
Second least non-divisor of n.
2
3, 4, 4, 5, 3, 5, 3, 5, 4, 4, 3, 7, 3, 4, 4, 5, 3, 5, 3, 6, 4, 4, 3, 7, 3, 4, 4, 5, 3, 7, 3, 5, 4, 4, 3, 7, 3, 4, 4, 6, 3, 5, 3, 5, 4, 4, 3, 7, 3, 4, 4, 5, 3, 5, 3, 5, 4, 4, 3, 8, 3, 4, 4, 5, 3, 5, 3, 5, 4, 4, 3, 7, 3, 4, 4, 5, 3, 5, 3, 6, 4, 4, 3, 8, 3, 4, 4, 5, 3, 7, 3, 5, 4
OFFSET
1,1
COMMENTS
An integer m >= 3 appears in the sequence if and only if m is a prime power or twice a prime power.
FORMULA
Sum_{n=1..N} a(n) = c*N + O((log N)^2 / (log log N)), where
c = Sum_{m >= 0} (1 + Sum_{m/2 < p^a <= m} (p-1)) / lcm(1,2,...,m) ~ 4.287434141625.
MATHEMATICA
f[n_, q_ : 1] := Module[{c, k}, c = 0; k = 2; While[If[! Divisible[n, k], c++]; c < q, k++]; k]; Table[f[n, 2], {n, 120}] (* Michael De Vlieger, Jun 08 2026 *)
PROG
(Python)
from itertools import count, islice
def A396771(n: int, rank: int = 2) -> int:
assert n > 0 and rank > 0, "Arguments must be positive integers."
return next(islice(filter(lambda x: n % x, count(2)), rank - 1, rank))
(PARI) a(n) = my(nb=0, i=1); while(nb !=2, i++; if (n % i, nb++)); i; \\ Michel Marcus, Jun 08 2026
CROSSREFS
Sequence in context: A158012 A334961 A032446 * A271563 A342938 A028949
KEYWORD
nonn,easy
AUTHOR
David Radcliffe, Jun 04 2026
STATUS
approved