Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|cite|improve this question
You mean k starts with 0? see this form: $(10^(n+1)-1)/9$ which is equivallent to yours, if it helps... – tomerg May 8 '11 at 13:35
Note: these are called repunit primes – Douglas S. Stones May 8 '11 at 13:36
@tomerg : Yes that's what I meant. Thanks for pointing it out. – Joel Cohen May 8 '11 at 13:47
@ Douglas S. Stones : Thanks for the reference. Also I see I had forgotten $u_{19}$ somehow. So it seems it's an open problem. This question was asked to me on an exam, so I thought there might be an easy answer I had overlooked. – Joel Cohen May 8 '11 at 13:52
up vote 10 down vote accepted

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.

share|cite|improve this answer
Thank you. Factoring $u_{71}$ already took a considerable amount of time. I surrendered at that point. – Joel Cohen May 8 '11 at 18:40
@Joel Cohen: Primality tests are usually much faster than factoring. A primality test on that number revealed that it is composite in less than a millisecond. – Charles May 12 '11 at 15:08
@ Charles : You're right. At first, I was also looking for a pattern in the factorization (any obvious factor). I should have had switched to just testing primality after a while. – Joel Cohen May 12 '11 at 15:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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