A288469 a(n) = n if n is a nonprime, otherwise take the prime index of n and repeat until you get a nonprime which is then a(n).
1, 1, 1, 4, 1, 6, 4, 8, 9, 10, 1, 12, 6, 14, 15, 16, 4, 18, 8, 20, 21, 22, 9, 24, 25, 26, 27, 28, 10, 30, 1, 32, 33, 34, 35, 36, 12, 38, 39, 40, 6, 42, 14, 44, 45, 46, 15, 48, 49, 50, 51, 52, 16, 54, 55, 56, 57, 58, 4, 60, 18, 62, 63, 64, 65, 66, 8, 68, 69, 70, 20, 72, 21, 74, 75, 76, 77, 78, 22, 80, 81, 82, 9, 84, 85, 86
Offset: 1
Keywords
Examples
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.
Links
- Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
Programs
-
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 *)
-
PARI
a(n)=while(isprime(n), n=primepi(n)); n \\ Charles R Greathouse IV, Jun 09 2017
Formula
From Robert Israel, Jun 09 2017: (Start)
Comments