Repunit
No. of known terms  11 

Conjectured no. of terms  Infinite 
First terms  11, 1111111111111111111, 11111111111111111111111 
Largest known term  (10^{8177207}−1)/9 
OEIS index 

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.^{[note 1]}
A repunit prime is a repunit that is also a prime number. Primes that are repunits in base2 are Mersenne primes. As of May 2023, the largest known prime number 2^{82,589,933} − 1, the largest probable prime R_{8177207} and the largest elliptic curve primalityproven prime R_{86453} are all repunits in various bases.
Definition
The baseb repunits are defined as (this b can be either positive or negative)
 [math]\displaystyle{ R_n^{(b)}\equiv 1 + b + b^2 + \cdots + b^{n1} = {b^n1\over{b1}}\qquad\mbox{for }b\ge2, n\ge1. }[/math]
Thus, the number R_{n}^{(b)} consists of n copies of the digit 1 in baseb representation. The first two repunits baseb for n = 1 and n = 2 are
 [math]\displaystyle{ R_1^{(b)}={b1\over{b1}}= 1 \qquad \text{and} \qquad R_2^{(b)}={b^21\over{b1}}= b+1\qquad\text{for}\ b\ge2. }[/math]
In particular, the decimal (base10) repunits that are often referred to as simply repunits are defined as
 [math]\displaystyle{ R_n \equiv R_n^{(10)} = {10^n1\over{101}} = {10^n1\over9}\qquad\mbox{for } n \ge 1. }[/math]
Thus, the number R_{n} = R_{n}^{(10)} consists of n copies of the digit 1 in base 10 representation. The sequence of repunits base10 starts with
Similarly, the repunits base2 are defined as
 [math]\displaystyle{ R_n^{(2)} = {2^n1\over{21}} = {2^n1}\qquad\mbox{for }n \ge 1. }[/math]
Thus, the number R_{n}^{(2)} consists of n copies of the digit 1 in base2 representation. In fact, the base2 repunits are the wellknown 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, ... (sequence A000225 in the OEIS).
Properties
 Any repunit in any base having a composite number of digits is necessarily composite. Only repunits (in any base) having a prime number of digits might be prime. This is a necessary but not sufficient condition. For example,
 R_{35}^{(b)} = 11111111111111111111111111111111111 = 11111 × 1000010000100001000010000100001 = 1111111 × 10000001000000100000010000001,
 since 35 = 7 × 5 = 5 × 7. This repunit factorization does not depend on the baseb in which the repunit is expressed.
 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 baseb.
 Any number x is a twodigit 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 base5, 11111 in base2) and 8191 (111 in base90, 1111111111111 in base2). The Goormaghtigh conjecture says there are only these two cases.
 Using the pigeonhole principle it can be easily shown that for relatively prime natural numbers n and b, there exists a repunit in baseb 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 nonzero residues modulo n there exist two repunits R_{i}^{(b)} and R_{j}^{(b)} with 1 ≤ i < j ≤ n such that R_{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, R_{j}^{(b)} − R_{i}^{(b)} = R_{j−i}^{(b)} × b^{i}. Now n divides the lefthand side of this equation, so it also divides the righthand 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 baseb 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 baseb 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)}.
Factorization of decimal repunits
(Prime factors colored red means "new factors", i. e. the prime factor divides R_{n} but does not divide R_{k} for all k < n) (sequence A102380 in the OEIS)^{[2]}



Smallest prime factor of R_{n} for n > 1 are
 11, 3, 11, 41, 3, 239, 11, 3, 11, 21649, 3, 53, 11, 3, 11, 2071723, 3, 1111111111111111111, 11, 3, 11, 11111111111111111111111, 3, 41, 11, 3, 11, 3191, 3, 2791, 11, 3, 11, 41, 3, 2028119, 11, 3, 11, 83, 3, 173, 11, 3, 11, 35121409, 3, 239, 11, ... (sequence A067063 in the OEIS)
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)}:
 [math]\displaystyle{ R_n^{(b)}=\frac{1}{b1}\prod_{dn}\Phi_d(b), }[/math]
where [math]\displaystyle{ \Phi_d(x) }[/math] is the [math]\displaystyle{ d^\mathrm{th} }[/math] cyclotomic polynomial and d ranges over the divisors of n. For p prime,
 [math]\displaystyle{ \Phi_p(x)=\sum_{i=0}^{p1}x^i, }[/math]
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 [math]\displaystyle{ \Phi_3(x) }[/math] and [math]\displaystyle{ \Phi_9(x) }[/math] are [math]\displaystyle{ x^2+x+1 }[/math] and [math]\displaystyle{ x^6+x^3+1 }[/math], 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 ... (sequence A004023 in OEIS). On April 3, 2007 Harvey Dubner (who also found R_{49081}) announced that R_{109297} is a probable prime.^{[3]} On July 15, 2007, Maksym Voznyy announced R_{270343} to be probably prime.^{[4]} Serge Batalov and Ryan Propper found R_{5794777} and R_{8177207} to be probable primes on April 20 and May 8, 2021, respectively.^{[5]} 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.^{[6]} On May 15, 2023 probable prime R_{86453} was eventually proven to be a prime.^{[7]}
It has been conjectured that there are infinitely many repunit primes^{[8]} 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}.
Algebra factorization of generalized repunit numbers
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 baseb. If n is a prime power (can be written as p^{r}, with p prime, r integer, p, r >0), then all repunit in baseb 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 baseb 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 baseb 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 baseb repunit primes.
The generalized repunit conjecture
A conjecture related to the generalized repunit primes:^{[9]}^{[10]} (the conjecture predicts where is the next generalized Mersenne prime, if the conjecture is true, then there are infinitely many repunit primes for all bases [math]\displaystyle{ b }[/math])
For any integer [math]\displaystyle{ b }[/math], which satisfies the conditions:
 [math]\displaystyle{ b\gt 1 }[/math].
 [math]\displaystyle{ b }[/math] is not a perfect power. (since when [math]\displaystyle{ b }[/math] is a perfect [math]\displaystyle{ r }[/math]th power, it can be shown that there is at most one [math]\displaystyle{ n }[/math] value such that [math]\displaystyle{ \frac{b^n1}{b1} }[/math] is prime, and this [math]\displaystyle{ n }[/math] value is [math]\displaystyle{ r }[/math] itself or a root of [math]\displaystyle{ r }[/math])
 [math]\displaystyle{ b }[/math] is not in the form [math]\displaystyle{ 4k^4 }[/math]. (if so, then the number has aurifeuillean factorization)
has generalized repunit primes of the form
 [math]\displaystyle{ R_p(b)=\frac{b^p1}{b1} }[/math]
for prime [math]\displaystyle{ p }[/math], the prime numbers will be distributed near the best fit line
 [math]\displaystyle{ Y=G \cdot \log_{b}\left( \log_{b}\left( R_{(b)}(n) \right) \right)+C, }[/math]
where limit [math]\displaystyle{ n\rightarrow\infty }[/math], [math]\displaystyle{ G=\frac{1}{e^\gamma}=0.561459483566... }[/math]
and there are about
 [math]\displaystyle{ \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)} }[/math]
baseb repunit primes less than N.
 [math]\displaystyle{ e }[/math] is the base of natural logarithm.
 [math]\displaystyle{ \gamma }[/math] is Euler–Mascheroni constant.
 [math]\displaystyle{ \log_{b} }[/math] is the logarithm in base [math]\displaystyle{ b }[/math]
 [math]\displaystyle{ R_{(b)}(n) }[/math] is the [math]\displaystyle{ n }[/math]th generalized repunit prime in baseb (with prime p)
 [math]\displaystyle{ C }[/math] is a data fit constant which varies with [math]\displaystyle{ b }[/math].
 [math]\displaystyle{ \delta=1 }[/math] if [math]\displaystyle{ b\gt 0 }[/math], [math]\displaystyle{ \delta=1.6 }[/math] if [math]\displaystyle{ b\lt 0 }[/math].
 [math]\displaystyle{ m }[/math] is the largest natural number such that [math]\displaystyle{ b }[/math] is a [math]\displaystyle{ 2^{m1} }[/math]th power.
We also have the following 3 properties:
 The number of prime numbers of the form [math]\displaystyle{ \frac{b^n1}{b1} }[/math] (with prime [math]\displaystyle{ p }[/math]) less than or equal to [math]\displaystyle{ n }[/math] is about [math]\displaystyle{ e^\gamma \cdot \log_{b}\big(\log_{b}(n)\big) }[/math].
 The expected number of prime numbers of the form [math]\displaystyle{ \frac{b^n1}{b1} }[/math] with prime [math]\displaystyle{ p }[/math] between [math]\displaystyle{ n }[/math] and [math]\displaystyle{ b \cdot n }[/math] is about [math]\displaystyle{ e^\gamma }[/math].
 The probability that number of the form [math]\displaystyle{ \frac{b^n1}{b1} }[/math] is prime (for prime [math]\displaystyle{ p }[/math]) is about [math]\displaystyle{ \frac{e^\gamma}{p \cdot \log_e(b)} }[/math].
History
Although they were not then known by that name, repunits in base10 were studied by many mathematicians during the nineteenth century in an effort to work out and predict the cyclic patterns of repeating decimals.^{[11]}
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 1860 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^{[11]} 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^{[12]} 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 sidedevelopment 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.
Demlo numbers
D. R. Kaprekar has defined Demlo numbers as concatenation of a left, middle and right part, where the left and right part must be of the same length (up to a possible leading zero to the left) and must add up to a repdigit number, and the middle part may contain any additional number of this repeated digit.^{[13]} They are named after Demlo railway station (now called Dombivili) 30 miles from Bombay on the then G.I.P. Railway, where Kaprekar started investigating them. 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,^{[14]} 1, 121, 12321, ..., 12345678987654321, 1234567900987654321, 123456790120987654321, ..., (sequence A002477 in the OEIS), 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 [math]\displaystyle{ b = 2 }[/math]
Footnotes
Notes
 ↑ Albert H. Beiler coined the term "repunit number" as follows:
A number which consists of a repeated of a single digit is sometimes called a monodigit number, and for convenience the author has used the term "repunit number" (repeated unit) to represent monodigit numbers consisting solely of the digit 1.^{[1]}
References
 ↑ Beiler 2013, pp. 83
 ↑ For more information, see Factorization of repunit numbers.
 ↑ Harvey Dubner, New Repunit R(109297)
 ↑ Maksym Voznyy, New PRP Repunit R(270343)
 ↑ OEIS: A004023
 ↑ "PrimePage Primes: R(49081)". 20220321. https://primes.utm.edu/primes/page.php?id=133761.
 ↑ "PrimePage Primes: R(86453)". 20230516. https://primes.utm.edu/primes/page.php?id=136044.
 ↑ Chris Caldwell. "repunit". The Prime Glossary. Prime Pages. http://primes.utm.edu/glossary/page.php?sort=Repunit.
 ↑ Deriving the Wagstaff Mersenne Conjecture
 ↑ Generalized Repunit Conjecture
 ↑ ^{11.0} ^{11.1} Dickson & Cresse 1999, pp. 164–167
 ↑ Francis 1988, pp. 240–246
 ↑ Kaprekar 1938a, 1938b, Gunjikar & Kaprekar 1939
 ↑ Weisstein, Eric W.. "Demlo Number". http://mathworld.wolfram.com/DemloNumber.html.
References
 Beiler, Albert H. (2013), Recreations in the Theory of Numbers: The Queen of Mathematics Entertains, Dover Recreational Math (2nd Revised ed.), New York: Dover Publications, ISBN 9780486210964, https://books.google.com/books?id=NbbbL9gMJ88C
 Dickson, Leonard Eugene; Cresse, G.H. (1999), History of the Theory of Numbers, Volume I: Divisibility and primality (2nd Reprinted ed.), Providence, RI: AMS Chelsea Publishing, ISBN 9780821819340, https://books.google.com/books?id=XnwsAQAAIAAJ
 Francis, Richard L. (1988), "Mathematical Haystacks: Another Look at Repunit Numbers", The College Mathematics Journal 19 (3): 240–246, doi:10.1080/07468342.1988.11973120
 Gunjikar, K. R.; Kaprekar, D. R. (1939), "Theory of Demlo numbers", Journal of the University of Bombay VIII (3): 3–9, http://OEIS.org/A249605/a249605.pdf
 Kaprekar, D. R. (1938a), "On Wonderful Demlo numbers", The Mathematics Student 6: 68, http://www.indianmathsociety.org.in/
 Kaprekar, D. R. (1938b), "Demlo numbers", J. Phys. Sci. Univ. Bombay VII (3)
 Kaprekar, D. R. (1948), Demlo numbers, Devlali, India: Khareswada
 Ribenboim, Paulo (19960202), The New Book of Prime Number Records, Computers and Medicine (3rd ed.), New York: Springer, ISBN 9780387944579, https://books.google.com/books?id=2VTSBwAAQBAJ
 Yates, Samuel (1982), Repunits and repetends, FL: Delray Beach, ISBN 9780960865208, https://books.google.com/books?id=3_vuAAAAMAAJ
External links
 Weisstein, Eric W.. "Repunit". http://mathworld.wolfram.com/Repunit.html.
 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^p1)/(b1) 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
Original source: https://en.wikipedia.org/wiki/Repunit.
Read more 