On this page
A repunit is a number written only with the digit 1: 1, 11, 111, 1111 and so on. MathWorld's repunit entry defines the n-digit repunit as R_n = (10ⁿ − 1)/9, because 10ⁿ − 1 is a string of n nines and dividing by 9 turns each 9 into a 1. A repdigit is a number made of one repeated digit, such as 777 or 4444, as in MathWorld's repdigit entry. Every repdigit is a digit times a repunit, so 777 = 7 × R₃ = 7 × 111 = 3 × 7 × 37.
When does one repunit divide another?
R_m divides R_n whenever m divides n. The reason fits in one line: if n = mk, then 10ⁿ − 1 = (10ᵐ)ᵏ − 1, and xᵏ − 1 always has the factor x − 1. Put x = 10ᵐ and divide both sides by 9. The argument is written out in the comments of OEIS sequence A004023.
You can see it in the digits: R₆ = 111111 = 111 × 1001 = 11 × 10101, so R₃ and R₂ both divide R₆. In the same way R₁₂ is divisible by R₁, R₂, R₃, R₄ and R₆, one repunit for each smaller divisor of 12, as the diagram above shows.
How do the repunits up to R₁₂ factorise?
Makoto Kamada keeps a table of repunit factorisations. The first twelve, after R₁ = 1, are:
R₂ = 11, a prime
R₃ = 111 = 3 × 37
R₄ = 1111 = 11 × 101
R₅ = 11111 = 41 × 271
R₆ = 111111 = 3 × 7 × 11 × 13 × 37
R₇ = 1111111 = 239 × 4649
R₈ = 11111111 = 11 × 73 × 101 × 137
R₉ = 111111111 = 3² × 37 × 333667
R₁₀ = 1111111111 = 11 × 41 × 271 × 9091
R₁₁ = 11111111111 = 21649 × 513239
R₁₂ = 111111111111 = 3 × 7 × 11 × 13 × 37 × 101 × 9901
Check the rule: R₆ contains R₂ = 11 and R₃ = 3 × 37, and R₁₀ contains R₅ = 41 × 271 and R₂.
Which repunits are prime?
A repunit can be prime only if its number of digits is prime, since otherwise a smaller repunit divides it. The converse fails: R₃ = 3 × 37 and R₅ = 41 × 271.
OEIS A004023 lists the known prime and probable-prime repunits as those with n = 2, 19, 23, 317, 1031, 49081, 86453, 109297, 270343, 5794777 and 8177207 digits. MathWorld's repunit prime page marks those up to R₁₀₉₂₉₇ as proven prime and the three larger ones as probable primes, not yet proved. So after 11 the next prime repunit has 19 digits, then 23.
How are repunits linked to the period of 1/p?
Write 1/7 as a decimal and it repeats every 6 digits: 0.142857142857… MathWorld's decimal expansion entry states that the period of 1/n is the least t for which n divides 10ᵗ − 1. Since 10ᵗ − 1 = 9 × R_t, a prime p other than 2, 3 and 5 divides R_t exactly when the period of 1/p divides t.
So the factor list doubles as a list of periods, matching OEIS A002371:
11 first divides R₂, and 1/11 = 0.0909… has period 2.
37 first divides R₃, and 1/37 = 0.027027… has period 3.
41 first divides R₅, and 1/41 = 0.0243902439… has period 5.
7 and 13 first divide R₆, and 1/7 and 1/13 both have period 6.
The prime 3 is the exception: 3 divides R_n exactly when 3 divides n, because the digit sum of R_n is n. The period of 1/p is the order of 10 modulo p, as in primitive roots modulo a prime and the Fermat test that Carmichael numbers fool.
Worked example: what is 111…1 with 2026 ones, modulo 7?
The period of 1/7 is 6, so 7 divides R_n exactly when 6 divides n.
2026 = 6 × 337 + 4, so 6 does not divide 2026 and 7 does not divide R₂₀₂₆.
For the remainder, split the digits: R₂₀₂₆ = R₂₀₂₂ × 10⁴ + R₄. Since 6 divides 2022, 7 divides R₂₀₂₂, so R₂₀₂₆ leaves the same remainder as R₄ = 1111.
1111 = 7 × 158 + 5, so the remainder is 5.
Repdigits follow at once. Is 777777 divisible by 13? It is 7 × R₆, and 13 divides R₆, so yes: 777777 = 13 × 59829.
The Fermi Concept Library covers every concept in mathematics, each with its own lesson. To practise, the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer.
Try it yourself: which of R₈, R₉ and R₁₀ does 101 divide, and why?



