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.
The baseb repunits are defined as (this b can be either positive or negative)
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
In particular, the decimal (base10) repunits that are often referred to as simply repunits are defined as
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
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
(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
For a more comprehensive list, see List of 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)}:
where is the cyclotomic polynomial and d ranges over the divisors of n. For p prime,
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 and are and , 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.
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
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.
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 )
For any integer , which satisfies the conditions:
has generalized repunit primes of the form
for prime , the prime numbers will be distributed near the best fit line
where limit ,
and there are about
baseb repunit primes less than N.
We also have the following 3 properties:
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.
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, ...