Repunit
≈ 14 min read
Names in other languages
No names in other languages are held for this entry yet.
Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.
In recreational mathematics, a repunit is a number like 11, 111, or 1111 that contains only the digit 1 — a more specific type of repdigit. The term stands for "repeated unit" and was coined in 1966 by Albert H. Beiler in his book Recreations in the Theory of Numbers. A repunit prime is a repunit that is also a prime number. Primes that are repunits in base-2 are Mersenne primes. As of May 2025, the largest known prime number , the largest probable prime R 8177207 and the largest elliptic curve primality-proven prime R 109297 are all repunits in various bases.
In recreational mathematics, a repunit is a number like 11, 111, or 1111 that contains only the digit 1 — a more specific type of repdigit. The term stands for "repeated unit" and was coined in 1966 by Albert H. Beiler in his book Recreations in the Theory of Numbers. A repunit prime is a repunit that is also a prime number. Primes that are repunits in base-2 are Mersenne primes. As of May 2025, the largest known prime number , the largest probable prime R 8177207 and the largest elliptic curve primality-proven prime R 109297 are all repunits in various bases. R_n^{(b)}\equiv 1 + b + b^2 + \cdots + b^{n-1} = {b^n-1\over{b-1}}\qquad\mbox{for }|b|\ge2, n\ge1. Thus, the number R n (b) consists of n copies of the digit 1 in base-b representation. The first two repunits base-b for n = 1 and n = 2 are R_1^{(b)}={b-1\over{b-1}}= 1 \qquad \text{and} \qquad R_2^{(b)}={b^2-1\over{b-1}}= b+1\qquad\text{for}\ |b|\ge2. In particular, the decimal (base-10) repunits that are often referred to as simply repunits are defined as R_n \equiv R_n^{(10)} = {10^n-1\over{10-1}} = {10^n-1\over9}\qquad\mbox{for } n \ge 1. Thus, the number R n = R n (10) consists of n copies of the digit 1 in base 10 representation. The sequence of repunits base-10 starts with 1, 11, 111, 1111, 11111, 111111, ... . Similarly, the repunits base-2 are defined as R_n^{(2)} = {2^n-1\over{2-1}} = {2^n-1}\qquad\mbox{for }n \ge 1. Thus, the number R n (2) consists of n copies of the digit 1 in base-2 representation. In fact, the base-2 repunits are the well-known Mersenne numbers M n = 2 n − 1, they start with 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, ... . R 35 (b) = = × 1 = × 1 , since 35 = 7 × 5 = 5 × 7. This repunit factorization does not depend on the base-b in which the repunit is expressed. Only repunits (in any base) having a prime number of digits can be prime. This is a necessary but not sufficient condition. For example, R 11 (2) = 2 11 − 1 = 2047 = 23 × 89. If p is an odd prime, then every prime q that divides R p (b) must be either 1 plus a multiple of 2p, or a factor of b − 1. For example, a prime factor of R 29 is 62003 = 1 + 2·29·1069. The reason is that the prime p is the smallest exponent greater than 1 such that q divides b p − 1, because p is prime. Therefore, unless q divides b − 1, p divides the Carmichael function of q, which is even and equal to q − 1. Any positive multiple of the repunit R n (b) contains at least n nonzero digits in base-b. Any number x is a two-digit repunit in base x − 1. The only known numbers that are repunits with at least 3 digits in more than one base simultaneously are 31 (111 in base-5, 11111 in base-2) and 8191 (111 in base-90, 1111111111111 in base-2). The Goormaghtigh conjecture says there are only these two cases. Using the pigeon-hole principle it can be easily shown that for relatively prime natural numbers n and b, there exists a repunit in base-b that is a multiple of n. To see this consider repunits R 1 (b) ,...,R n (b) . Because there are n repunits but only n−1 non-zero residues modulo n there exist two repunits R i (b) and R j (b) with 1 ≤ i i (b) and R j (b) have the same residue modulo n. It follows that R j (b) − R i (b) has residue 0 modulo n, i.e. is divisible by n. Since R j (b) − R i (b) consists of j − i ones followed by i zeroes, . Now n divides the left-hand side of this equation, so it also divides the right-hand side, but since n and b are relatively prime, n must divide R j−i (b) . The Feit–Thompson conjecture is that R q (p) never divides R p (q) for two distinct primes p and q. Using the Euclidean Algorithm for repunits definition: R 1 (b) = 1; R n (b) = R n−1 (b) × b + 1, any consecutive repunits R n−1 (b) and R n (b) are relatively prime in any base-b for any n. If m and n have a common divisor d, R m (b) and R n (b) have the common divisor R d (b) in any base-b for any m and n. That is, the repunits of a fixed base form a strong divisibility sequence. As a consequence, If m and n are relatively prime, R m (b) and R n (b) are relatively prime. The Euclidean Algorithm is based on gcd(m, n) = gcd(m − n, n) for m > n. Similarly, using R m (b) − R n (b) × b m−n = R m−n (b) , it can be easily shown that gcd(R m (b) , R n (b) ) = gcd(R m−n (b) , R n (b) ) for m > n. Therefore, if gcd(m, n) = d, then gcd(R m (b) , R n (b) ) = R d (b) .
Repunit primes
The definition of repunits was motivated by recreational mathematicians looking for prime factors of such numbers. It is easy to show that if n is divisible by a, then R n (b) is divisible by R a (b) : R_n^{(b)}=\frac{1}{b-1}\prod_{d|n}\Phi_d(b), where \Phi_d(x) is the d^\mathrm{th} cyclotomic polynomial and d ranges over the divisors of n. For p prime, \Phi_p(x)=\sum_{i=0}^{p-1}x^i, which has the expected form of a repunit when x is substituted with b. For example, 9 is divisible by 3, and thus R 9 is divisible by R 3 —in fact, 111111111 = 111 · 1001001. The corresponding cyclotomic polynomials \Phi_3(x) and \Phi_9(x) are x^2+x+1 and x^6+x^3+1 , respectively. Thus, for R n to be prime, n must necessarily be prime, but it is not sufficient for n to be prime. For example, R 3 = 111 = 3 · 37 is not prime. Except for this case of R 3 , p can only divide R n for prime n if p = 2kn + 1 for some k.
Decimal repunit primes
R n is prime for n = 2, 19, 23, 317, 1031, 49081, 86453, 109297 ... (sequence A004023 in OEIS). On July 15, 2007, Maksym Voznyy announced R 270343 to be probably prime. Serge Batalov and Ryan Propper found R 5794777 and R 8177207 to be probable primes on April 20 and May 8, 2021, respectively. As of their discovery, each was the largest known probable prime. On March 22, 2022, probable prime R 49081 was eventually proven to be a prime. On May 15, 2023, probable prime R 86453 was eventually proven to be a prime. On May 26, 2025, probable prime R 109297 was eventually proven to be a prime. It has been conjectured that there are infinitely many repunit primes and they seem to occur roughly as often as the prime number theorem would predict: the exponent of the Nth repunit prime is generally around a fixed multiple of the exponent of the (N−1)th. The prime repunits are a trivial subset of the permutable primes, i.e., primes that remain prime after any permutation of their digits. Particular properties are The remainder of R n modulo 3 is equal to the remainder of n modulo 3. Using 10 a ≡ 1 (mod 3) for any a ≥ 0, n ≡ 0 (mod 3) ⇔ R n ≡ 0 (mod 3) ⇔ R n ≡ 0 (mod R 3 ), n ≡ 1 (mod 3) ⇔ R n ≡ 1 (mod 3) ⇔ R n ≡ R 1 ≡ 1 (mod R 3 ), n ≡ 2 (mod 3) ⇔ R n ≡ 2 (mod 3) ⇔ R n ≡ R 2 ≡ 11 (mod R 3 ). Therefore, 3 | n ⇔ 3 | R n ⇔ R 3 | R n . The remainder of R n modulo 9 is equal to the remainder of n modulo 9. Using 10 a ≡ 1 (mod 9) for any a ≥ 0, n ≡ r (mod 9) ⇔ R n ≡ r (mod 9) ⇔ R n ≡ R r (mod R 9 ), for 0 ≤ r < 9. Therefore, 9 | n ⇔ 9 | R n ⇔ R 9 | R n . If b is a perfect power (can be written as m n , with m, n integers, n > 1) differs from 1, then there is at most one repunit in base-b. If n is a prime power (can be written as p r , with p prime, r integer, p, r >0), then all repunit in base-b are not prime aside from R p and R 2 . R p can be either prime or composite, the former examples, b = −216, −128, 4, 8, 16, 27, 36, 100, 128, 256, etc., the latter examples, b = −243, −125, −64, −32, −27, −8, 9, 25, 32, 49, 81, 121, 125, 144, 169, 196, 216, 225, 243, 289, etc., and R 2 can be prime (when p differs from 2) only if b is negative, a power of −2, for example, b = −8, −32, −128, −8192, etc., in fact, the R 2 can also be composite, for example, b = −512, −2048, −32768, etc. If n is not a prime power, then no base-b repunit prime exists, for example, b = 64, 729 (with n = 6), b = 1024 (with n = 10), and b = −1 or 0 (with n any natural number). Another special situation is b = −4k 4 , with k positive integer, which has the aurifeuillean factorization, for example, b = −4 (with k = 1, then R 2 and R 3 are primes), and b = −64, −324, −1024, −2500, −5184, ... (with k = 2, 3, 4, 5, 6, ...), then no base-b repunit prime exists. It is also conjectured that when b is neither a perfect power nor −4k 4 with k positive integer, then there are infinity many base-b repunit primes. R_p(b)=\frac{b^p-1}{b-1} for prime p , the prime numbers will be distributed near the best fit line Y=G \cdot \log_ \left( \log_ \left( R_{(b)}(n) \right) \right)+C, where limit n\rightarrow\infty , G=\frac{1}{e^\gamma}=0.561459483566... and there are about \left( \log_e(N)+m \cdot \log_e(2) \cdot \log_e \big( \log_e(N) \big) +\frac{1}{\sqrt N}-\delta \right) \cdot \frac{e^\gamma}{\log_e(|b|)} base-b repunit primes less than N. e is the base of natural logarithm. \gamma is Euler–Mascheroni constant. \log_ is the logarithm in base |b| R_{(b)}(n) is the n th generalized repunit prime in baseb (with prime p) C is a data fit constant which varies with b . \delta=1 if b>0 , \delta=1.6 if b . m is the largest natural number such that -b is a 2^{m-1} th power. We also have the following 3 properties: The number of prime numbers of the form \frac{b^n-1}{b-1} (with prime p ) less than or equal to n is about e^\gamma \cdot \log_ \big(\log_ (n)\big) . The expected number of prime numbers of the form \frac{b^n-1}{b-1} with prime p between n and |b| \cdot n is about e^\gamma . The probability that number of the form \frac{b^n-1}{b-1} is prime (for prime p ) is about \frac{e^\gamma}{p \cdot \log_e(|b|)} .
History
Although they were not then known by that name, repunits in base-10 were studied by many mathematicians during the nineteenth century in an effort to work out and predict the cyclic patterns of repeating decimals. It was found very early on that for any prime p greater than 5, the period of the decimal expansion of 1/p is equal to the length of the smallest repunit number that is divisible by p. Tables of the period of reciprocal of primes up to 60,000 had been published by 18601 and permitted the factorization by such mathematicians as Reuschle of all repunits up to R 16 and many larger ones. By 1880, even R 17 to R 36 had been factored and it is curious that, though Édouard Lucas showed no prime below three million had period nineteen, there was no attempt to test any repunit for primality until early in the twentieth century. The American mathematician Oscar Hoppe proved R 19 to be prime in 1916, and Lehmer and Kraitchik independently found R 23 to be prime in 1929. Further advances in the study of repunits did not occur until the 1960s, when computers allowed many new factors of repunits to be found and the gaps in earlier tables of prime periods corrected. R 317 was found to be a probable prime circa 1966 and was proved prime eleven years later, when R 1031 was shown to be the only further possible prime repunit with fewer than ten thousand digits. It was proven prime in 1986, but searches for further prime repunits in the following decade consistently failed. However, there was a major side-development in the field of generalized repunits, which produced a large number of new primes and probable primes. Since 1999, four further probably prime repunits have been found, but it is unlikely that any of them will be proven prime in the foreseeable future because of their huge size. The Cunningham project endeavours to document the integer factorizations of (among other numbers) the repunits to base 2, 3, 5, 6, 7, 10, 11, and 12. He calls Wonderful Demlo numbers those of the form 1, 121, 12321, 1234321, ..., 12345678987654321. The fact that these are the squares of the repunits has led some authors to call Demlo numbers the infinite sequence of these, 1, 121, 12321, ..., 12345678987654321, 1234567900987654321, 123456790120987654321, ..., , although one can check these are not Demlo numbers for p = 10, 19, 28, ...
See also
All one polynomial — Another generalization Goormaghtigh conjecture Repeating decimal Repdigit Wagstaff prime — can be thought of as repunit primes with negative base b = -2
References
External links
The main tables of the Cunningham project. Repunit at The Prime Pages by Chris Caldwell. Repunits and their prime factors at World!Of Numbers. Prime generalized repunits of at least 1000 decimal digits by Andy Steward Repunit Primes Project Giovanni Di Maria's repunit primes page. Smallest odd prime p such that (b^p-1)/(b-1) and (b^p+1)/(b+1) is prime for bases 2<=b<=1024 Factorization of repunit numbers Generalized repunit primes in base -50 to 50
Text derived from https://en.wikipedia.org/w/index.php?oldid=1363388346 under CC BY-SA 4.0; modifications have been made.