login
A250480
a(1) = 0, and for n > 1: if n is a prime, a(n) = n, otherwise a(n) = A020639(n) - 1, where A020639(n) gives the least prime dividing n.
2
0, 2, 3, 1, 5, 1, 7, 1, 2, 1, 11, 1, 13, 1, 2, 1, 17, 1, 19, 1, 2, 1, 23, 1, 4, 1, 2, 1, 29, 1, 31, 1, 2, 1, 4, 1, 37, 1, 2, 1, 41, 1, 43, 1, 2, 1, 47, 1, 6, 1, 2, 1, 53, 1, 4, 1, 2, 1, 59, 1, 61, 1, 2, 1, 4, 1, 67, 1, 2, 1, 71, 1, 73, 1, 2, 1, 6, 1, 79, 1, 2, 1, 83, 1, 4, 1, 2, 1, 89
OFFSET
1,2
LINKS
FORMULA
a(n) = n for all prime n, and a(n) = A020639(n) - 1 for all composite n.
a(n) = A020639(n) - A005171(n).
MATHEMATICA
Join[{0}, Table[If[PrimeQ[n], n, FactorInteger[n][[1, 1]]-1], {n, 2, 100}]] (* Harvey P. Dale, Apr 14 2023 *)
PROG
(Scheme) (define (A250480 n) (if (prime? n) n (- (A020639 n) 1)))
CROSSREFS
Cf. also A005171 (characteristic function for nonprimes), A020639 (the smallest prime divisor of n).
Differs from A251758 for the first time at n = 2431 = 11*13*17, where a(2431) = 10, while A251758(2431) = 9.
Sequence in context: A053815 A194446 A251758 * A326584 A166333 A322966
KEYWORD
nonn
AUTHOR
STATUS
approved