login
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

%I #17 Apr 14 2023 12:06:38

%S 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,

%T 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,

%U 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

%N 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.

%H Antti Karttunen, <a href="/A250480/b250480.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = n for all prime n, and a(n) = A020639(n) - 1 for all composite n.

%F a(n) = A020639(n) - A005171(n).

%t Join[{0},Table[If[PrimeQ[n],n,FactorInteger[n][[1,1]]-1],{n,2,100}]] (* _Harvey P. Dale_, Apr 14 2023 *)

%o (Scheme) (define (A250480 n) (if (prime? n) n (- (A020639 n) 1)))

%Y Cf. also A005171 (characteristic function for nonprimes), A020639 (the smallest prime divisor of n).

%Y Differs from A251758 for the first time at n = 2431 = 11*13*17, where a(2431) = 10, while A251758(2431) = 9.

%K nonn

%O 1,2

%A _Antti Karttunen_ & _Michel Lagneau_, Dec 09 2014