# Why do repunit primes have only a prime number of consecutive $1$s?

Repunit primes are primes of the form $\frac{10^n - 1}{9} = 1111\dots11 \space (n-1 \space ones)$. Each repunit prime is denoted by $R_i$, where $i$ is the number of consecutive $1$s it has.

So far, very few of these have been found: $R_2, R_{19}, R_{23}, R_{317}, R_{1031}, R_{49081}, R_{86453}, R_{109297}, R_{270343}$.

One thing to observe in all of these is that all of these have a prime subscript. Is this a prerequisite for all repunit primes. Does each repunit prime written as $R_p$ have to have $p$ as prime?

I tried my hand at this: A repunit prime $R_i$, can be written as $10^{i-1} + 10^{i-2} \dots + 10^{2} + 10 + 1$. We are required to prove that if $i$ is composite then $R_i$ is composite. Clearly, if $i$ is even, then $R_i$ is divisible by $11$. $3|i$, then $3|R_i$.

So, $i$ has to be of the form $6n \pm 1$. I could not put any more constraints of this. Is there an elementary proof for this?

The number whose decimal representation consists of $ab$ consecutive $1$'s is divisible by the number whose decimal representation consists of $a$ consecutive $1$'s.

To see this, think of the usual "long division" algorithm. It will terminate with $0$ remainder. The quotient will have decimal representation $1$, followed by $a-1$ $0$'s, then a $1$, then $a-1$ $0$'s, and so on.

Thus if $k$ is composite, then $R_k$ is composite.

• Another way to see this is that $R_{ab} = 10^{a(b-1)}R_a + 10^{a(b-2)}R_a \dots + 10^aR_a + R_a$ which is clearly divisible by $R_a$ – Gerard Aug 20 '13 at 13:39

$$\frac{10^{pq}-1}{9}=\frac{10^p-1}{9}\cdot \left(10^{q(p-1)}+10^{q(p-2)}+\cdots+1\right)$$ It is easy to see that the expression on the right-hand side telescopes.

• "...telescopes upon multiplication" would be clearer. I was confused for a second! =) – Pedro Tamaroff Aug 20 '13 at 6:03

If $i$ is composite, write $i=jk$ then you have $R_i=\displaystyle\frac{10^i-1}{9}=\displaystyle\frac{10^{jk}-1}{9}=\displaystyle\frac{(10^j)^k-1}{9}=(10^{j({k-1})}+10^{j({k-2})}+...+10^j+1)\cdot \frac{10^j-1}{9}$ so if $i$ is composite then $R_i$ is composite, because of that if $R_i$ is prime then $i$ is prime.

Think about what happens when you multiply a three-digit number by $1001$. You get that number's digits repeated. Likewise a four-digit number by $10001$, and if you multiply it by $100010001$ then you get the digits repeated twice. What is going on is simply several multiplications by $1$, shifted far enough apart that the digits of each do not interfere with each other.

Along these lines, \begin{align}111,111,111,111 &= 1,111 \times 100,010,001 \\ &= 111 \times 1,001,001,001 \\ &= 11 \times 10,101,010,101.\end{align}

corresponding to factoring $12$ into $4 \times 3$, $3 \times 4$, or $2 \times 6$ respectively. This should make intuitively obvious that a repunit of length $mn$ is the product of a repunit of length $m$ and a number formed of $n$ $1$s each separated by $m - 1$ zeroes.