login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A049076
Number of steps in the prime index chain for the n-th prime.
58
1, 2, 3, 1, 4, 1, 2, 1, 1, 1, 5, 1, 2, 1, 1, 1, 3, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 6, 1, 1, 1, 1, 1, 2, 1, 1, 1, 3, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 4, 1, 2, 1, 1, 1, 1, 1, 3, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 3, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 1
OFFSET
1,2
COMMENTS
Let p(k) = k-th prime, let S(p) = S(p(k)) = k, the subscript of p; a(n) = order of primeness of p(n) = 1+m where m is largest number such that S(S(..S(p(n))...)) with m S's is a prime.
The record holders correspond to A007097.
LINKS
N. Fernandez, An order of primeness [cached copy, included with permission of the author]
FORMULA
Let b(n) = 0 if n is nonprime, otherwise b(n) = k where n is the k-th prime. Then a(n) is the number of times you can apply b to the n-th prime before you hit a nonprime.
a(n) = 1 + A078442(n). - R. J. Mathar, Jul 07 2012
a(n) = A078442(A000040(n)). - Alois P. Heinz, Mar 16 2020
EXAMPLE
11 is 5th prime, so S(11)=5, 5 is 3rd prime, so S(S(11))=3, 3 is 2nd prime, so S(S(S(11)))=2, 2 is first prime, so S(S(S(S(11))))=1, not a prime. Thus a(5)=4.
Alternatively, a(5) = 4: the 5th prime is 11 and its prime index chain is 11->5->3->2->1->0. a(6) = 1: the 6th prime is 13 and its prime index chain is 13->6->0.
MAPLE
A049076 := proc(n)
if not isprime(n) then
1 ;
else
1+procname(numtheory[pi](n)) ;
end if;
end proc:
seq(A049076(n), n=1..30) ; # R. J. Mathar, Jan 28 2014
MATHEMATICA
A049076 f[n_] := Length[ NestWhileList[ PrimePi, n, PrimeQ]]; Table[ f[n], {n, 105}] (* Robert G. Wilson v, Mar 11 2004 *)
Table[Length[NestWhileList[PrimePi[#]&, Prime[n], PrimeQ[#]&]]-1, {n, 110}] (* Harvey P. Dale, May 07 2018 *)
PROG
(PARI) apply(p->my(s=1); while(isprime(p=primepi(p)), s++); s, primes(100)) \\ Charles R Greathouse IV, Nov 20 2012
(Haskell)
a049076 = (+ 1) . a078442 -- Reinhard Zumkeller, Jul 14 2013
CROSSREFS
KEYWORD
nice,nonn,easy
EXTENSIONS
Additional comments from Gabriel Cunningham (gcasey(AT)mit.edu), Apr 12 2003
STATUS
approved