$127$ has an interesting property: It is the $31$st prime number and its rank ($31$) is also a prime. $31$ is the $11$th prime so its rank is also a prime. $11$ is also a prime number with a rank ($5$) that is also a prime. $5$ is the 3rd prime number and and so its rank ($3$) is also a prime. And finally $3$ is the $2$nd prime so its rank is also a prime... Is there a name for primes whose rank (index in the prime series) is also a prime? That is:

If $a_i$ is the $i$th prime number, then $i$ is a also a prime.

How about numbers like $127$ where going down ranks of ranks always produce prime numbers (down to rank $2$ of course)? The first $11$ :-) primes in this (infinite) series would be:

$3, 5, 11, 31, 127, 709, 5381, 52711, 648391, 9737333, 174440041, \dotsc$

Many thanks!


2 Answers 2


This sequence is well-know at OEIS, namely sequence A007097, where one can find a lot of information and references: $$ 1, 2, 3, 5, 11, 31, 127, 709, 5381, 52711, 648391, 9737333, 174440041, 3657500101, 88362852307, 2428095424619, 75063692618249, 2586559730396077, 98552043847093519, 4123221751654370051, 188272405179937051081, 9332039515881088707361, 499720579610303128776791, 28785866289100396890228041$$ The name is "Primeth recurrence": $a(n+1) = a(n)$-th prime.

  • $\begingroup$ Thanks! That is exactly the info I was looking for... $\endgroup$
    – Pan Pap
    Aug 24, 2017 at 13:41
  • $\begingroup$ Done! Thanks once more... $\endgroup$
    – Pan Pap
    Aug 24, 2017 at 16:07
  • $\begingroup$ Does anyone here know if it's a finite sequence or if those are just the last ones someone bothered to calculate ? $\endgroup$ Aug 24, 2017 at 16:34
  • 7
    $\begingroup$ It's clearly infinite - given a(n) = p you can always calculate a(n+1) as being the p-th prime. $\endgroup$ Aug 24, 2017 at 16:50
  • 1
    $\begingroup$ Another relevant OEIS sequence: oeis.org/A288469 $\endgroup$ Aug 24, 2017 at 20:11

Sloane's OEIS simply calls them "prime-indexed primes."

Some more common notation would be $p_i$ for the $i$th prime. Then we have the prime counting function $\pi(p_i) = i$ (this function is defined for all positive numbers).

Using these notations, we can write the sequence $$1, p_1, p_{p_1}, p_{p_{p_1}}, p_{p_{p_{p_1}}}, \ldots$$

This is Wilson's primeth recurrence.

Although both the sequence of prime-indexed primes and Wilson's primeth recurrence are infinite sequences, the former can be said to be less "exclusive" than the latter. If we iterate the function $f(n) = p_{\pi(n)}$, we'll find that all prime-indexed primes eventually reach a nonprime, but only those in Wilson's primeth recurrence reach $1$ without any composite numbers along the way.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.