In mathematics, a repunit (from the words repeated and unit) is a number like 11, 111, or 1111 that consists of repeated units, or 1's. A mathematical shorthand for a repunit is a capital "R" subscripted with the number of repeated units. 11 is therefore R2, 111 R3, and 1111 R4. 11 is the first repunit and 111 the second, however, because although 1 is R1, 1, for obvious reasons, is not a repunit.

A repunit prime is simply a repunit that is a prime number. For a repunit Rn to be prime, it is a necessary but not sufficient condition that the number (or sum) of its digits also be prime. For example, R3, R5, R7 are not primes. Indexes for which repunits are primes are {2, 19, 23, 317, 1031, ...}. It is not known whether there are infinitely many prime repunits. Prime repunits are similar to a special class of primes that remain primes after any permutation of their digits. They are called permutable primes or absolute primes.

In binary, all repunit primes are also Mersenne primes.

See also:

Note: Some mathematical theoreticians regard the repunit as an arbitrary concept, arguing that it depends on the use of decimal numerals. But other mathematical theoricians justify the concept with the mathematical formula (10^N - 1)/9, such as author Paulo Ribenboim. Even this formula can be generalized to any base, if we let B stand for the base number, (B^N - 1)/(B - 1).