A066136 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).
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, 19, 11, 20, 21, 22, 23, 24, 12, 25, 26, 27, 13, 28, 14, 29, 30, 31, 15, 32, 33, 34, 35, 36, 16, 37, 38, 39, 40, 41, 17, 42, 18, 43, 44, 45, 46, 47, 19, 48, 49, 50, 20, 51, 21, 52, 53
Offset: 1
Keywords
Links
- Harry J. Smith, Table of n, a(n) for n=1..1000
Programs
-
Mathematica
Do[s=n; If[PrimeQ[n], Print[PrimePi[n]]]; If[ !PrimeQ[n], Print[n-PrimePi[n]-1]], {n, 1, 1000}]
-
PARI
a(n) = { if (isprime(n), primepi(n), n - primepi(n) - 1) } \\ Harry J. Smith, Feb 02 2010
Formula
a(n) = pi(n) if n is prime; a(n) = n-pi(n)-1 if n is not prime.
a(n) = A026238(n), n>1. - R. J. Mathar, Sep 30 2008
Comments