login
a(n) is obtained by applying the map k -> prime(k) n times, starting at n.
7

%I #47 Jun 26 2021 09:19:20

%S 2,5,31,277,5381,87803,2269733,50728129,1559861749,64988430769,

%T 2428095424619,119543903707171,5519908106212193,248761474969923757

%N a(n) is obtained by applying the map k -> prime(k) n times, starting at n.

%H Piotr Miska and János T. Tóth, <a href="https://arxiv.org/abs/1908.10421">On interesting subsequences of the sequence of primes</a>, arXiv:1908.10421 [math.NT], 2019. See DiagP.

%H Błażej Żmija, <a href="https://arxiv.org/abs/1909.12139">A note on primes with prime indices</a>, arXiv:1909.12139 [math.NT], 2019.

%e a(3) is 31 because the third prime is 5, the fifth prime is 11 and for the 3rd iteration, the eleventh prime is 31.

%e To get a(4): 4 -> 7 -> 17 -> 59 -> 277.

%p a:= n-> (ithprime@@n)(n):

%p seq(a(n), n=1..8); # _Alois P. Heinz_, Jun 21 2019

%t Table[ Nest[ Prime, n, n ], {n, 1, 11} ]

%o (PARI) a(n) = my(k = n); for (j=1, n, k = prime(k);); k; \\ _Michel Marcus_, Jan 01 2017

%o (Python)

%o from sympy import prime

%o def A058009(n):

%o k = n

%o for _ in range(n):

%o k = prime(k)

%o return k # _Chai Wah Wu_, Apr 06 2021

%Y Cf. A000040, A006450, A049090, ...

%Y For composites, see A280327. - _Matthew Campbell_, Jan 01 2017

%K nonn,hard,more

%O 1,1

%A _Robert G. Wilson v_, Nov 13 2000

%E Edited by _N. J. A. Sloane_, Oct 30 2008 at the suggestion of _R. J. Mathar_

%E a(12)-a(13) from _Donovan Johnson_, Feb 17 2011

%E a(14) from _Giovanni Resta_, Sep 29 2019

%E a(13) corrected by _Daniel Suteu_, Jun 20 2021