OFFSET
1,4
REFERENCES
C. Kimberling, Fractal sequences and interspersions, Ars Combinatoria, vol. 45, p. 157, 1997.
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..10000
Sean A. Irvine, Java program (github)
C. Kimberling, Interspersions
EXAMPLE
From Sean A. Irvine, May 20 2019: (Start)
The prime counting function, pi(n), is iterated (possibly zero times) until a nonprime is reached. If the result of this iteration is m, then a(n) = m - pi(m). Examples:
n=11: pi(11)=5, pi(5)=3, pi(3)=2, pi(2)=1. Hence, m=1 and so a(11) = 1-pi(1) = 1.
n=12: is already nonprime, hence m=12 and so a(12) = 12-pi(12) = 7.
n=13: pi(13)=6 (a nonprime), hence m=6 and so a(13) = 6-pi(6) = 3.
(End)
MATHEMATICA
m = 30; list = Table[Length[NestWhileList[PrimePi, n, PrimeQ]], {n, m}]; Table[Length@Position[Take[list, k], list[[k]]], {k, Length[list]}] (* Birkas Gyorgy, Apr 04 2011 *)
primefractal[n_]:= (# - PrimePi[#]) &@NestWhile[PrimePi, n, PrimeQ]; Array[primefractal, 30] (* Birkas Gyorgy, Apr 04 2011 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
EXTENSIONS
Terms a(67) onward added by G. C. Greubel, Feb 28 2018
Offset corrected by Sean A. Irvine, May 20 2019
STATUS
approved