OFFSET
1,4
COMMENTS
a(n) = 1 for n in A007097. - Robert Israel, Jun 09 2017
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
FORMULA
From Robert Israel, Jun 09 2017: (Start)
EXAMPLE
For n = 17: 17 is a prime, so you take the prime index of 17 which is 7. 7 is a prime, so you take the prime index of 7 which is 4. 4 is a nonprime, so a(17) = 4.
MAPLE
f:= proc(n) option remember; if isprime(n) then procname(numtheory:-pi(n)) else n fi end proc:
map(f, [$1..100]); # Robert Israel, Jun 09 2017
MATHEMATICA
Table[If[!PrimeQ@ n, n, NestWhile[PrimePi, n, PrimeQ]], {n, 86}] (* Michael De Vlieger, Jun 09 2017 *)
PROG
(PARI) a(n)=while(isprime(n), n=primepi(n)); n \\ Charles R Greathouse IV, Jun 09 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Peter Weiss, Jun 09 2017
STATUS
approved