

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, 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
(list;
graph;
refs;
listen;
history;
text;
internal format)



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)
a(n) = n + A010051(n)*(a(A000720(n))n).
a(A114537(n,k)) = A114537(n,1). (End)


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

Cf. A000720, A007097, A010051, A114537.
Sequence in context: A318876 A330356 A329428 * A076717 A200360 A228451
Adjacent sequences: A288466 A288467 A288468 * A288470 A288471 A288472


KEYWORD

nonn


AUTHOR

Peter Weiss, Jun 09 2017


STATUS

approved



