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.


$$\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.


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.