For $n \ge 1$ an integer, let's denote

$u_n = \sum_{k = 0}^{n-1} 10^k$

That is $u_1 = 1$, $u_2 = 11$, $u_3 = 111$, $u_4 = 1111$, ...

My question is the following : Which of them are prime numbers ?

What I know so far :

  • If $u_n$ is prime, then $n$ is prime (meaning there's an obvious factorization when $n$ is not prime).

  • When $p$ is prime, $u_p$ can either be prime (2, 19 and 23 being the only examples I found so far) or not prime (all primes up to 67 with the exception of 2, 19 and 23). But I haven't been able to see any pattern.

Any thought is welcome. Maybe a sub-question would be to know whether there's a finite or infinite number of such primes. Thanks for your help.


OEIS has a list of the number of 1's where these are prime. It only has eight of them, the next is 317. So you could have looked for a while.