Repunit Numbers

Last Updated : 11 Sep, 2026

A repunit is a number that contains only the digit 1, repeated one or more times. We usually use Rn to represent an n-digit repunit.

For example, in base 10:

  • R1 = 1
  • R2 = 11
  • R3 = 111
  • R4 = 1111

The word repunit comes from "repeated unit", where the unit digit is 1.

Formula

The n-th repunit is given by:

\boxed{ R_n =\frac{10^n-1}{9}}

This is the standard formula for decimal repunits.

This formula works because a string of n ones can be written as a geometric series:

An n-digit repunit can be written as

Rn ​= 1 + 10 + 102 + . . . + 10n−1 (This is a geometric series.)

Using the formula for the sum of a geometric series:

1+r+r^2+\cdots+r^{n-1}=\frac{r^n-1}{r-1}

put r = 10: R_n =\frac{10^n-1}{10-1}

Therefore, we got the formula: R_n =\frac{10^n-1}{9}

Generalized Repunits

Repunits can be defined in any base b:

\boxed{ R_n (b) =\frac{b^n-1}{b-1}}

For example, in binary (base 2):

1, 11, 111, 1111.... which correspond to 1, 3, 7, 15... in decimal (these are the Mersenne numbers, 2ⁿ − 1).

Some Interesting Facts

1. Squaring a repunit produces a numeric palindrome in which the digits first increase and then decrease.

  • (1)2 = 1
  • (11)2 = 121
  • (111)2 = 12321
  • (1111)2 = 1234321
  • (11111)2 = 123454321

and so on.

This pattern continues up to (R9).

2. Concatenating repunits creates another repunit; Rm+n = 10n Rm + Rn.

103 R2 ​+ R3​ = 1000(11) + 111 = 11111 = R5

3. The greatest common divisor of two repunits is the repunit whose number of digits is the GCD of their lengths. \boxed{\gcd(R_m,R_n)=R_{\gcd(m,n)}}

For example, gcd(6, 9) = 3.

Therefore, gcd(R6, R9) = R3 = 111.

In other words, gcd(111111, 111111111) = 111

4. Two repunits can be combined using the identity {R_{m+n}=9R_mR_n+R_m+R_n}

For example, taking (m = n = 3),

R_6=9R_3^2+2R_3.

Therefore, 111111 = 9(111)2 + 2(111).

This also gives the interesting identity

\boxed{(3R_n)^2+2R_n=R_{2n}}.

For example, 3332 + 222 = 111111.

5. Every positive integer that is not divisible by 2 or 5 divides at least one repunit.

If a positive integer n is not divisible by 2 or 5, then it divides some decimal repunit.

For example, 7 ∣ 111111 because 111111 = 7 × 15873.

Similarly, 21 ∣ 111111

because 111111 = 21 × 5291.

Therefore, this property applies to both prime and composite numbers.

6. A repunit (R_m) divides another repunit (R_n) exactly when (m) divides (n).

\boxed{R_m\mid R_n\iff m\mid n}

For example, (3\mid6), so R3 = 111 divides R6 = 111111.

Indeed, 111111\div111=1001.

7. Repunits have exactly the same power of 3 as their number of digits \boxed{v_3(R_n)=v_3(n)}.

In simple terms, the highest power of (3) dividing (Rn) is exactly the same as the highest power of (3) dividing (n).

For example, 18=2\times3^2, so the highest power of 3 dividing 18 is 32 = 9.

Therefore, the same highest power of 3 divides R18: 32∣ R18​,

but 3^3\nmid R_{18}.

Similarly, since 9 = 32, the repunit R9 ​= 111111111 is divisible by 9, but not by 27.

So, the power of 3 in a repunit depends directly on the number of digits in the repunit.

8. Every repunit Rn n > 1 has a prime factor that does not divide any earlier repunit Rk, where 1 ≤ k < n.

For example, R2 = 11 has prime factor (11), while R3 = 111 = 3\times37 introduces the new prime factor (37).

Similarly, R6 ​= 111111 = 3 × 7 × 11 × 13 × 37.

The prime factors 7 and 13 are new because they do not divide R1​, R2​, . . ., R5.

9. The sum of the first few repunits produces (123456789)

Adding the first repunits gives a very simple pattern:

  • R1 = 1
  • R1 + R2 = 1 + 11 = 12
  • R1 + R2 + R3 = 1 + 11 + 111 = 123

and so on.

Therefore, \boxed{R_1+R_2+\cdots+R_9=123456789}.

For example, 1 + 11 + 111 + 1111 = 1234.

This happens because each additional repunit adds exactly one more (1) to the next place.

10. A repunit is divisible by 3 exactly when its number of digits is divisible by 3

Since 10 ≡ 1 (mod3),

we have Rn ≡ n (mod3)

Therefore, 3 ∣ Rn  ⟺  3∣n.

For example, R6 = 111111.

Because 6 is divisible by 3,

111111 is also divisible by 3: 111111 ÷ 3 = 37037.

11. The remainder of a repunit when divided by 9 is the same as its number of digits

A repunit contains only the digit 1.

Since 10 ≡ 1 (mod9),

each 1 contributes 1 to the remainder.

Therefore, Rn ≡ n (mod9).

For example, R5 = 11111.

Adding its digits gives 1 + 1 + 1 + 1 + 1 = 5.

So, 11111 ≡ 5 (mod9).

And for n = 9,

R9 = 111111111 is divisible by 9, because

1+1+1+1+1+1+1+1+1 = 9.

Therefore, 9∣Rn​ ⟺ 9∣n​.

12. Repunits follow a recurrence relation

A repunit can be generated from the two previous repunits using \boxed{R_{n+1}=11R_n-10R_{n-1}}.

For example, R2​ = 11, R3​ = 111.

To get R4, R4 = 11 R3 − 10R2.

Substituting the values,

R4 = 11(111) − 10(11)

= 1221 − 110 = 1111.

So, \boxed{R_4=1111}.

Comment

Explore