login
Primes are replaced by their local sequence number in A000040, while composites are replaced by their sequence number in A002808; (a kind of eigen- or home-indexing).
3

%I #19 Mar 23 2020 07:08:15

%S 0,1,2,1,3,2,4,3,4,5,5,6,6,7,8,9,7,10,8,11,12,13,9,14,15,16,17,18,10,

%T 19,11,20,21,22,23,24,12,25,26,27,13,28,14,29,30,31,15,32,33,34,35,36,

%U 16,37,38,39,40,41,17,42,18,43,44,45,46,47,19,48,49,50,20,51,21,52,53

%N Primes are replaced by their local sequence number in A000040, while composites are replaced by their sequence number in A002808; (a kind of eigen- or home-indexing).

%C Primality or compositeness is recognizable from the terms: if successor of a term(>2) is larger by one than the term, then it labels a composite number.

%H Harry J. Smith, <a href="/A066136/b066136.txt">Table of n, a(n) for n=1..1000</a>

%F a(n) = PrimePi(n) if n is prime; a(n) = n-PrimePi(n)-1 if n is not prime.

%F a(n) = A026238(n), n>1. [_R. J. Mathar_, Sep 30 2008]

%t Do[s=n; If[PrimeQ[n], Print[PrimePi[n]]]; If[ !PrimeQ[n], Print[n-PrimePi[n]-1]], {n, 1, 1000}]

%o (PARI) { for (n=1, 1000, if (isprime(n), a=primepi(n), a=n - primepi(n) - 1); write("b066136.txt", n, " ", a) ) } \\ _Harry J. Smith_, Feb 02 2010

%Y Cf. A000040, A000720, A002808, A026238.

%K nonn

%O 1,3

%A _Labos Elemer_, Dec 07 2001