# Repunit

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]

No. of known terms 9 Infinite 11, 1111111111111111111, 11111111111111111111111 (10270343-1)/9 A004022Primes of the form (10^n - 1)/9

A repunit prime is a repunit that is also a prime number. Primes that are repunits in base 2 are Mersenne primes.

## Definition

The base-b repunits are defined as (this b can be either positive or negative)

${\displaystyle R_{n}^{(b)}\equiv 1+b+b^{2}+\cdots +b^{n-1}={b^{n}-1 \over {b-1}}\qquad {\mbox{for }}|b|\geq 2,n\geq 1.}$

Thus, the number Rn(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

${\displaystyle 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|\geq 2.}$

In particular, the decimal (base-10) repunits that are often referred to as simply repunits are defined as

${\displaystyle R_{n}\equiv R_{n}^{(10)}={10^{n}-1 \over {10-1}}={10^{n}-1 \over 9}\qquad {\mbox{for }}n\geq 1.}$

Thus, the number Rn = Rn(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, ... (sequence A002275 in the OEIS).

Similarly, the repunits base 2 are defined as

${\displaystyle R_{n}^{(2)}={2^{n}-1 \over {2-1}}={2^{n}-1}\qquad {\mbox{for }}n\geq 1.}$

Thus, the number Rn(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 Mn = 2n  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,
R35(b) = 11111111111111111111111111111111111 = 11111 × 1000010000100001000010000100001 = 1111111 × 10000001000000100000010000001,
since 35 = 7 × 5 = 5 × 7. This repunit factorization does not depend on the base b in which the repunit is expressed.
• If p is an odd prime, then every prime q that divides Rp(b) must be either 1 plus a multiple of 2p, or a factor of b - 1. For example, a prime factor of R29 is 62003 = 1 + 2·29·1069. The reason is that the prime p is the smallest exponent greater than 1 such that q divides bp 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 Rn(b) contains at least n nonzero digits in base b.
• 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 each n and b such that n and b are relatively prime there exists a repunit in base b that is a multiple of n. To see this consider repunits R1(b),...,Rn(b). Because there are n repunits but only n-1 non-zero residues modulo n there exist two repunits Ri(b) and Rj(b) with 1≤i<jn such that Ri(b) and Rj(b) have the same residue modulo n. It follows that Rj(b) - Ri(b) has residue 0 modulo n, i.e. is divisible by n. Rj(b) - Ri(b) consists of j - i ones followed by i zeroes. Thus, Rj(b) - Ri(b) = Rj-i(b) x bi . Since n divides the left-hand side it also divides the right-hand side and since n and b are relatively prime n must divide Rj-i(b).
• The Feit–Thompson conjecture is that Rq(p) never divides Rp(q) for two distinct primes p and q.
• Using the Euclidean Algorithm for repunits definition: R1(b) = 1; Rn(b) = Rn-1(b) x b + 1, any consecutive repunits Rn-1(b) and Rn(b) are relatively prime in any base b for any n.
• If m and n have a common divisor d, Rm(b) and Rn(b) have the common divisor Rd(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, Rm(b) and Rn(b) are relatively prime. The Euclidean Algorithm is based on gcd(m, n) = gcd(m - n, n) for m > n. Similarly, using Rm(b) - Rn(b) × bm-n = Rm-n(b), it can be easily shown that gcd(Rm(b), Rn(b)) = gcd(Rm-n(b), Rn(b)) for m > n. Therefore if gcd(m, n) = d, then gcd(Rm(b), Rn(b)) = Rd(b).

## Factorization of decimal repunits

(Prime factors colored red means "new factors", i. e. the prime factor divides Rn but does not divide Rk for all k < n) (sequence A102380 in the OEIS)[2]

 R1 = 1 R2 = 11 R3 = 3 · 37 R4 = 11 · 101 R5 = 41 · 271 R6 = 3 · 7 · 11 · 13 · 37 R7 = 239 · 4649 R8 = 11 · 73 · 101 · 137 R9 = 32 · 37 · 333667 R10 = 11 · 41 · 271 · 9091
 R11 = 21649 · 513239 R12 = 3 · 7 · 11 · 13 · 37 · 101 · 9901 R13 = 53 · 79 · 265371653 R14 = 11 · 239 · 4649 · 909091 R15 = 3 · 31 · 37 · 41 · 271 · 2906161 R16 = 11 · 17 · 73 · 101 · 137 · 5882353 R17 = 2071723 · 5363222357 R18 = 32 · 7 · 11 · 13 · 19 · 37 · 52579 · 333667 R19 = 1111111111111111111 R20 = 11 · 41 · 101 · 271 · 3541 · 9091 · 27961
 R21 = 3 · 37 · 43 · 239 · 1933 · 4649 · 10838689 R22 = 112 · 23 · 4093 · 8779 · 21649 · 513239 R23 = 11111111111111111111111 R24 = 3 · 7 · 11 · 13 · 37 · 73 · 101 · 137 · 9901 · 99990001 R25 = 41 · 271 · 21401 · 25601 · 182521213001 R26 = 11 · 53 · 79 · 859 · 265371653 · 1058313049 R27 = 33 · 37 · 757 · 333667 · 440334654777631 R28 = 11 · 29 · 101 · 239 · 281 · 4649 · 909091 · 121499449 R29 = 3191 · 16763 · 43037 · 62003 · 77843839397 R30 = 3 · 7 · 11 · 13 · 31 · 37 · 41 · 211 · 241 · 271 · 2161 · 9091 · 2906161

Smallest prime factor of Rn 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 Rn(b) is divisible by Ra(b):

${\displaystyle R_{n}^{(b)}={\frac {1}{b-1}}\prod _{d|n}\Phi _{d}(b),}$

where ${\displaystyle \Phi _{d}(x)}$ is the ${\displaystyle d^{\mathrm {th} }}$ cyclotomic polynomial and d ranges over the divisors of n. For p prime,

${\displaystyle \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 R9 is divisible by R3in fact, 111111111 = 111 · 1001001. The corresponding cyclotomic polynomials ${\displaystyle \Phi _{3}(x)}$ and ${\displaystyle \Phi _{9}(x)}$ are ${\displaystyle x^{2}+x+1}$ and ${\displaystyle x^{6}+x^{3}+1}$, respectively. Thus, for Rn to be prime, n must necessarily be prime, but it is not sufficient for n to be prime. For example, R3 = 111 = 3 · 37 is not prime. Except for this case of R3, p can only divide Rn for prime n if p = 2kn + 1 for some k.

### Decimal repunit primes

Rn is prime for n = 2, 19, 23, 317, 1031, ... (sequence A004023 in OEIS). R49081 and R86453 are probably prime. On April 3, 2007 Harvey Dubner (who also found R49081) announced that R109297 is a probable prime.[3] He later announced there are no others from R86453 to R200000.[4] On July 15, 2007 Maksym Voznyy announced R270343 to be probably prime,[5] along with his intent to search to 400000. As of November 2012, all further candidates up to R2500000 have been tested, but no new probable primes have been found so far.

It has been conjectured that there are infinitely many repunit primes[6] 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 Rn modulo 3 is equal to the remainder of n modulo 3. Using 10a ≡ 1 (mod 3) for any a 0,
n ≡ 0 (mod 3) ⇔ Rn ≡ 0 (mod 3) ⇔ Rn ≡ 0 (mod R3),
n ≡ 1 (mod 3) ⇔ Rn ≡ 1 (mod 3) ⇔ RnR1 ≡ 1 (mod R3),
n ≡ 2 (mod 3) ⇔ Rn ≡ 2 (mod 3) ⇔ RnR2 ≡ 11 (mod R3).
Therefore, 3 | n ⇔ 3 | RnR3 | Rn.
• The remainder of Rn modulo 9 is equal to the remainder of n modulo 9. Using 10a ≡ 1 (mod 9) for any a 0,
nr (mod 9) ⇔ Rnr (mod 9) ⇔ RnRr (mod R9),
for 0 r < 9.
Therefore, 9 | n ⇔ 9 | RnR9 | Rn.

### Base 2 repunit primes

Base 2 repunit primes are called Mersenne primes.

### Base 3 repunit primes

The first few base 3 repunit primes are

13, 1093, 797161, 3754733257489862401973357979128773, 6957596529882152968992225251835887181478451547013 (sequence A076481 in the OEIS),

corresponding to ${\displaystyle n}$ of

3, 7, 13, 71, 103, 541, 1091, 1367, 1627, 4177, 9011, 9551, ... (sequence A028491 in the OEIS).

### Base 4 repunit primes

The only base 4 repunit prime is 5 (${\displaystyle 11_{4}}$). ${\displaystyle 4^{n}-1=\left(2^{n}+1\right)\left(2^{n}-1\right)}$, and 3 always divides ${\displaystyle 2^{n}+1}$ when n is odd and ${\displaystyle 2^{n}-1}$ when n is even. For n greater than 2, both ${\displaystyle 2^{n}+1}$ and ${\displaystyle 2^{n}-1}$ are greater than 3, so removing the factor of 3 still leaves two factors greater than 1. Therefore, the number cannot be prime.

### Base 5 repunit primes

The first few base 5 repunit primes are

31, 19531, 12207031, 305175781, 177635683940025046467781066894531, 14693679385278593849609206715278070972733319459651094018859396328480215743184089660644531, 35032461608120426773093239582247903282006548546912894293926707097244777067146515037165954709053039550781, 815663058499815565838786763657068444462645532258620818469829556933715405574685778402862015856733535201783524826169013977050781 (sequence A086122 in the OEIS),

corresponding to ${\displaystyle n}$ of

3, 7, 11, 13, 47, 127, 149, 181, 619, 929, 3407, ... (sequence A004061 in the OEIS).

### Base 6 repunit primes

The first few base 6 repunit primes are

7, 43, 55987, 7369130657357778596659, 3546245297457217493590449191748546458005595187661976371, 133733063818254349335501779590081460423013416258060407531857720755181857441961908284738707408499507 (sequence A165210 in the OEIS),

corresponding to ${\displaystyle n}$ of

2, 3, 7, 29, 71, 127, 271, 509, 1049, 6389, 6883, ... (sequence A004062 in the OEIS).

### Base 7 repunit primes

The first few base 7 repunit primes are

2801, 16148168401, 85053461164796801949539541639542805770666392330682673302530819774105141531698707146930307290253537320447270457,
138502212710103408700774381033135503926663324993317631729227790657325163310341833227775945426052637092067324133850503035623601

corresponding to ${\displaystyle n}$ of

5, 13, 131, 149, 1699, ... (sequence A004063 in the OEIS).

### Base 8 repunit primes

The only base 8 repunit prime is 73 (${\displaystyle 111_{8}}$). ${\displaystyle 8^{n}-1=\left(4^{n}+2^{n}+1\right)\left(2^{n}-1\right)}$, and 7 divides ${\displaystyle 4^{n}+2^{n}+1}$ when n is not divisible by 3 and ${\displaystyle 2^{n}-1}$ when n is a multiple of 3.

### Base 9 repunit primes

There are no base 9 repunit primes. ${\displaystyle 9^{n}-1=\left(3^{n}+1\right)\left(3^{n}-1\right)}$, and both ${\displaystyle 3^{n}+1}$ and ${\displaystyle 3^{n}-1}$ are even and greater than 4.

### Base 11 repunit primes

The first few base 11 repunit primes are

50544702849929377, 6115909044841454629, 1051153199500053598403188407217590190707671147285551702341089650185945215953, 567000232521795739625828281267171344486805385881217575081149660163046217465544573355710592079769932651989153833612198334843467861091902034340949

corresponding to ${\displaystyle n}$ of

17, 19, 73, 139, 907, 1907, 2029, 4801, 5153, 10867, ... (sequence A005808 in the OEIS).

### Base 12 repunit primes

The first few base 12 repunit primes are

13, 157, 22621, 29043636306420266077, 43570062353753446053455610056679740005056966111842089407838902783209959981593077811330507328327968191581, 388475052482842970801320278964160171426121951256610654799120070705613530182445862582590623785872890159937874339918941

corresponding to ${\displaystyle n}$ of

2, 3, 5, 19, 97, 109, 317, 353, 701, 9739, ... (sequence A004064 in the OEIS).

### Base 20 repunit primes

The first few base 20 repunit primes are

421, 10778947368421, 689852631578947368421

corresponding to ${\displaystyle n}$ of

3, 11, 17, 1487, ... (sequence A127995 in the OEIS).

### Bases ${\displaystyle b}$ such that ${\displaystyle R_{p}(b)}$ is prime for prime ${\displaystyle p}$

Smallest base ${\displaystyle b}$ such that ${\displaystyle R_{p}(b)}$ is prime (where ${\displaystyle p}$ is the ${\displaystyle n}$th prime) are

2, 2, 2, 2, 5, 2, 2, 2, 10, 6, 2, 61, 14, 15, 5, 24, 19, 2, 46, 3, 11, 22, 41, 2, 12, 22, 3, 2, 12, 86, 2, 7, 13, 11, 5, 29, 56, 30, 44, 60, 304, 5, 74, 118, 33, 156, 46, 183, 72, 606, 602, 223, 115, 37, 52, 104, 41, 6, 338, 217, 13, 136, 220, 162, 35, 10, 218, 19, 26, 39, 12, 22, 67, 120, 195, 48, 54, 463, 38, 41, 17, 808, 404, 46, 76, 793, 38, 28, 215, 37, 236, 59, 15, 514, 260, 498, 6, 2, 95, 3, ... (sequence A066180 in the OEIS)

Smallest base ${\displaystyle b}$ such that ${\displaystyle R_{p}(-b)}$ is prime (where ${\displaystyle p}$ is the ${\displaystyle n}$th prime) are

3, 2, 2, 2, 2, 2, 2, 2, 2, 7, 2, 16, 61, 2, 6, 10, 6, 2, 5, 46, 18, 2, 49, 16, 70, 2, 5, 6, 12, 92, 2, 48, 89, 30, 16, 147, 19, 19, 2, 16, 11, 289, 2, 12, 52, 2, 66, 9, 22, 5, 489, 69, 137, 16, 36, 96, 76, 117, 26, 3, 159, 10, 16, 209, 2, 16, 23, 273, 2, 460, 22, 3, 36, 28, 329, 43, 69, 86, 271, 396, 28, 83, 302, 209, 11, 300, 159, 79, 31, 331, 52, 176, 3, 28, 217, 14, 410, 252, 718, 164, ... (sequence A103795 in the OEIS)
 ${\displaystyle p}$ bases ${\displaystyle b}$ such that ${\displaystyle R_{p}(b)}$ is prime (only lists positive bases) OEIS sequence 2 2, 4, 6, 10, 12, 16, 18, 22, 28, 30, 36, 40, 42, 46, 52, 58, 60, 66, 70, 72, 78, 82, 88, 96, 100, 102, 106, 108, 112, 126, 130, 136, 138, 148, 150, 156, 162, 166, 172, 178, 180, 190, 192, 196, 198, 210, 222, 226, 228, 232, 238, 240, 250, 256, 262, 268, 270, 276, 280, 282, 292, 306, 310, 312, 316, 330, 336, 346, 348, 352, 358, 366, 372, 378, 382, 388, 396, 400, 408, 418, 420, 430, 432, 438, 442, 448, 456, 460, 462, 466, 478, 486, 490, 498, 502, 508, 520, 522, 540, 546, 556, 562, 568, 570, 576, 586, 592, 598, 600, 606, 612, 616, 618, 630, 640, 642, 646, 652, 658, 660, 672, 676, 682, 690, 700, 708, 718, 726, 732, 738, 742, 750, 756, 760, 768, 772, 786, 796, 808, 810, 820, 822, 826, 828, 838, 852, 856, 858, 862, 876, 880, 882, 886, 906, 910, 918, 928, 936, 940, 946, 952, 966, 970, 976, 982, 990, 996, ... A006093 3 2, 3, 5, 6, 8, 12, 14, 15, 17, 20, 21, 24, 27, 33, 38, 41, 50, 54, 57, 59, 62, 66, 69, 71, 75, 77, 78, 80, 89, 90, 99, 101, 105, 110, 111, 117, 119, 131, 138, 141, 143, 147, 150, 153, 155, 161, 162, 164, 167, 168, 173, 176, 188, 189, 192, 194, 203, 206, 209, 215, 218, 231, 236, 245, 246, 266, 272, 278, 279, 287, 288, 290, 293, 309, 314, 329, 332, 336, 342, 344, 348, 351, 357, 369, 378, 381, 383, 392, 395, 398, 402, 404, 405, 414, 416, 426, 434, 435, 447, 453, 455, 456, 476, 489, 495, 500, 512, 518, 525, 530, 531, 533, 537, 540, 551, 554, 560, 566, 567, 572, 579, 582, 584, 603, 605, 609, 612, 621, 624, 626, 635, 642, 644, 668, 671, 677, 686, 696, 701, 720, 726, 728, 735, 743, 747, 755, 761, 762, 768, 773, 782, 785, 792, 798, 801, 812, 818, 819, 825, 827, 836, 839, 846, 855, 857, 860, 864, 875, 878, 890, 894, 897, 899, 911, 915, 918, 920, 927, 950, 959, 960, 969, 974, 981, 987, 990, 992, 993, ... A002384 5 2, 7, 12, 13, 17, 22, 23, 24, 28, 29, 30, 40, 43, 44, 50, 62, 63, 68, 73, 74, 77, 79, 83, 85, 94, 99, 110, 117, 118, 120, 122, 127, 129, 134, 143, 145, 154, 162, 164, 165, 172, 175, 177, 193, 198, 204, 208, 222, 227, 239, 249, 254, 255, 260, 263, 265, 274, 275, 277, 285, 288, 292, 304, 308, 327, 337, 340, 352, 359, 369, 373, 393, 397, 408, 414, 417, 418, 437, 439, 448, 457, 459, 474, 479, 490, 492, 495, 503, 505, 514, 519, 528, 530, 538, 539, 540, 550, 557, 563, 567, 568, 572, 579, 594, 604, 617, 637, 645, 650, 662, 679, 694, 699, 714, 728, 745, 750, 765, 770, 772, 793, 804, 805, 824, 837, 854, 860, 864, 868, 880, 890, 919, 942, 954, 967, 968, 974, 979, ... A049409 7 2, 3, 5, 6, 13, 14, 17, 26, 31, 38, 40, 46, 56, 60, 61, 66, 68, 72, 73, 80, 87, 89, 93, 95, 115, 122, 126, 128, 146, 149, 156, 158, 160, 163, 180, 186, 192, 203, 206, 208, 220, 221, 235, 237, 238, 251, 264, 266, 280, 282, 290, 294, 300, 303, 320, 341, 349, 350, 353, 363, 381, 395, 399, 404, 405, 417, 418, 436, 438, 447, 450, 461, 464, 466, 478, 523, 531, 539, 548, 560, 583, 584, 591, 599, 609, 611, 622, 646, 647, 655, 657, 660, 681, 698, 700, 710, 717, 734, 760, 765, 776, 798, 800, 802, 805, 822, 842, 856, 863, 870, 878, 899, 912, 913, 926, 927, 931, 940, 941, 942, 947, 959, 984, 998, ... A100330 11 5, 17, 20, 21, 30, 53, 60, 86, 137, 172, 195, 212, 224, 229, 258, 268, 272, 319, 339, 355, 365, 366, 389, 390, 398, 414, 467, 480, 504, 534, 539, 543, 567, 592, 619, 626, 654, 709, 735, 756, 766, 770, 778, 787, 806, 812, 874, 943, 973, ... A162862 13 2, 3, 5, 7, 34, 37, 43, 59, 72, 94, 98, 110, 133, 149, 151, 159, 190, 207, 219, 221, 251, 260, 264, 267, 282, 286, 291, 319, 355, 363, 373, 382, 397, 398, 402, 406, 408, 412, 436, 442, 486, 489, 507, 542, 544, 552, 553, 582, 585, 592, 603, 610, 614, 634, 643, 645, 689, 708, 720, 730, 744, 769, 772, 806, 851, 853, 862, 882, 912, 928, 930, 952, 968, 993, ... A217070 17 2, 11, 20, 21, 28, 31, 55, 57, 62, 84, 87, 97, 107, 109, 129, 147, 149, 157, 160, 170, 181, 189, 191, 207, 241, 247, 251, 274, 295, 297, 315, 327, 335, 349, 351, 355, 364, 365, 368, 379, 383, 410, 419, 423, 431, 436, 438, 466, 472, 506, 513, 527, 557, 571, 597, 599, 614, 637, 653, 656, 688, 708, 709, 720, 740, 762, 835, 836, 874, 974, 976, 980, 982, 986, ... A217071 19 2, 10, 11, 12, 14, 19, 24, 40, 45, 46, 48, 65, 66, 67, 75, 85, 90, 103, 105, 117, 119, 137, 147, 164, 167, 179, 181, 205, 220, 235, 242, 253, 254, 263, 268, 277, 303, 315, 332, 337, 366, 369, 370, 389, 399, 404, 424, 431, 446, 449, 480, 481, 506, 509, 521, 523, 531, 547, 567, 573, 581, 622, 646, 651, 673, 736, 768, 787, 797, 807, 810, 811, 817, 840, 846, 857, 867, 869, 870, 888, 899, 902, 971, 988, 990, 992, ... A217072 23 10, 40, 82, 113, 127, 141, 170, 257, 275, 287, 295, 315, 344, 373, 442, 468, 609, 634, 646, 663, 671, 710, 819, 834, 857, 884, 894, 904, 992, 997, ... A217073 29 6, 40, 65, 70, 114, 151, 221, 229, 268, 283, 398, 451, 460, 519, 554, 587, 627, 628, 659, 687, 699, 859, 884, 915, 943, 974, 986, ... A217074 31 2, 14, 19, 31, 44, 53, 71, 82, 117, 127, 131, 145, 177, 197, 203, 241, 258, 261, 276, 283, 293, 320, 325, 379, 387, 388, 406, 413, 461, 462, 470, 486, 491, 534, 549, 569, 582, 612, 618, 639, 696, 706, 723, 746, 765, 767, 774, 796, 802, 877, 878, 903, 923, 981, 991, 998, ... A217075 37 61, 77, 94, 97, 99, 113, 126, 130, 134, 147, 161, 172, 187, 202, 208, 246, 261, 273, 285, 302, 320, 432, 444, 503, 523, 525, 563, 666, 680, 709, 740, 757, 787, 902, 962, 964, 969, ... A217076 41 14, 53, 55, 58, 71, 76, 82, 211, 248, 271, 296, 316, 430, 433, 439, 472, 545, 553, 555, 596, 663, 677, 682, 746, 814, 832, 885, 926, 947, 959, ... A217077 43 15, 21, 26, 86, 89, 114, 123, 163, 180, 310, 332, 377, 409, 438, 448, 457, 477, 526, 534, 556, 586, 612, 653, 665, 690, 692, 709, 760, 783, 803, 821, 848, 877, 899, 909, 942, 981, ... A217078 47 5, 17, 19, 55, 62, 75, 89, 98, 99, 132, 172, 186, 197, 220, 268, 278, 279, 288, 439, 443, 496, 579, 583, 587, 742, 777, 825, 911, 966, ... A217079 53 24, 45, 60, 165, 235, 272, 285, 298, 307, 381, 416, 429, 623, 799, 858, 924, 929, 936, ... A217080 59 19, 70, 102, 116, 126, 188, 209, 257, 294, 359, 451, 461, 468, 470, 638, 653, 710, 762, 766, 781, 824, 901, 939, 964, 995, ... A217081 61 2, 19, 69, 88, 138, 155, 205, 234, 336, 420, 425, 455, 470, 525, 555, 561, 608, 626, 667, 674, 766, 779, 846, 851, 937, 971, 998, ... A217082 67 46, 122, 238, 304, 314, 315, 328, 332, 346, 372, 382, 426, 440, 491, 496, 510, 524, 528, 566, 638, 733, 826, ... A217083 71 3, 6, 17, 24, 37, 89, 132, 374, 387, 402, 421, 435, 453, 464, 490, 516, 708, 736, 919, 947, 981, ... A217084 73 11, 15, 75, 114, 195, 215, 295, 335, 378, 559, 566, 650, 660, 832, 871, 904, 966, ... A217085 79 22, 112, 140, 158, 170, 254, 271, 330, 334, 354, 390, 483, 528, 560, 565, 714, 850, 888, 924, 929, 933, 935, 970, ... A217086 83 41, 146, 386, 593, 667, 688, 906, 927, 930, ... A217087 89 2, 114, 159, 190, 234, 251, 436, 616, 834, 878, ... A217088 97 12, 90, 104, 234, 271, 339, 420, 421, 428, 429, 464, 805, 909, 934, ... A217089 101 22, 78, 164, 302, 332, 359, 387, 428, 456, 564, 617, 697, 703, 704, 785, 831, 979, ... 103 3, 52, 345, 392, 421, 472, 584, 617, 633, 761, 767, 775, 785, 839, ... 107 2, 19, 61, 68, 112, 157, 219, 349, 677, 692, 700, 809, 823, 867, 999, ... 109 12, 57, 72, 79, 89, 129, 158, 165, 239, 240, 260, 277, 313, 342, 421, 445, 577, 945, ... 113 86, 233, 266, 299, 334, 492, 592, 641, 656, 719, 946, ... 127 2, 5, 6, 47, 50, 126, 151, 226, 250, 401, 427, 473, 477, 486, 497, 585, 624, 644, 678, 685, 687, 758, 896, 897, 936, ... 131 7, 493, 567, 591, 593, 613, 764, 883, 899, 919, 953, ... 137 13, 166, 213, 355, 586, 669, 707, 768, 833, ... 139 11, 50, 221, 415, 521, 577, 580, 668, 717, 720, 738, 902, ... 149 5, 7, 68, 79, 106, 260, 319, 502, 550, 779, 855, ... 151 29, 55, 57, 160, 176, 222, 255, 364, 427, 439, 642, 660, 697, 863, ... 157 56, 71, 76, 181, 190, 317, 338, 413, 426, 609, 694, 794, 797, 960, ... 163 30, 62, 118, 139, 147, 291, 456, 755, 834, 888, 902, 924, ... 167 44, 45, 127, 175, 182, 403, 449, 453, 476, 571, 582, 700, 749, 764, 929, 957, ... 173 60, 62, 139, 141, 303, 313, 368, 425, 542, 663, ... 179 304, 478, 586, 942, 952, 975, ... 181 5, 37, 171, 427, 509, 571, 618, 665, 671, 786, ... 191 74, 214, 416, 477, 595, 664, 699, 712, 743, 924, ... 193 118, 301, 486, 554, 637, 673, 736, ... 197 33, 236, 248, 262, 335, 363, 388, 593, 763, 813, ... 199 156, 362, 383, 401, 442, 630, 645, 689, 740, 921, 936, 944, 983, 988, ... 211 46, 57, 354, 478, 539, 581, 653, 829, 835, 977, ... 223 183, 186, 219, 221, 661, 749, 905, 914, ... 227 72, 136, 235, 240, 251, 322, 350, 500, 523, 556, 577, 671, 688, 743, 967, ... 229 606, 725, 754, 858, 950, ... 233 602, ... 239 223, 260, 367, 474, 564, 862, ... 241 115, 163, 223, 265, 270, 330, 689, 849, ... 251 37, 246, 267, 618, 933, ... 257 52, 78, 435, 459, 658, 709, ... 263 104, 131, 161, 476, 494, 563, 735, 842, 909, 987, ... 269 41, 48, 294, 493, 520, 812, 843, ... 271 6, 21, 186, 201, 222, 240, 586, 622, 624, ... 277 338, 473, 637, 940, 941, 978, ... 281 217, 446, 606, 618, 790, 864, ... 283 13, 197, 254, 288, 323, 374, 404, 943, ... 293 136, 388, 471, ...

### List of repunit primes base ${\displaystyle b}$

Smallest prime ${\displaystyle p>2}$ such that ${\displaystyle R_{p}(b)}$ is prime are (start with ${\displaystyle b=2}$, 0 if no such ${\displaystyle p}$ exists)

3, 3, 0, 3, 3, 5, 3, 0, 19, 17, 3, 5, 3, 3, 0, 3, 25667, 19, 3, 3, 5, 5, 3, 0, 7, 3, 5, 5, 5, 7, 0, 3, 13, 313, 0, 13, 3, 349, 5, 3, 1319, 5, 5, 19, 7, 127, 19, 0, 3, 4229, 103, 11, 3, 17, 7, 3, 41, 3, 7, 7, 3, 5, 0, 19, 3, 19, 5, 3, 29, 3, 7, 5, 5, 3, 41, 3, 3, 5, 3, 0, 23, 5, 17, 5, 11, 7, 61, 3, 3, 4421, 439, 7, 5, 7, 3343, 17, 13, 3, 0, ... (sequence A128164 in the OEIS)

Smallest prime ${\displaystyle p>2}$ such that ${\displaystyle R_{p}(-b)}$ is prime are (start with ${\displaystyle b=2}$, 0 if no such ${\displaystyle p}$ exists, question mark if this term is currently unknown)

3, 3, 3, 5, 3, 3, 0, 3, 5, 5, 5, 3, 7, 3, 3, 7, 3, 17, 5, 3, 3, 11, 7, 3, 11, 0, 3, 7, 139, 109, 0, 5, 3, 11, 31, 5, 5, 3, 53, 17, 3, 5, 7, 103, 7, 5, 5, 7, 1153, 3, 7, 21943, 7, 3, 37, 53, 3, 17, 3, 7, 11, 3, 0, 19, 7, 3, 757, 11, 3, 5, 3, 7, 13, 5, 3, 37, 3, 3, 5, 3, 293, 19, 7, 167, 7, 7, 709, 13, 3, 3, 37, 89, 71, 43, 37, ?, 19, 7, 3, ... (sequence A084742 in the OEIS)
 ${\displaystyle b}$ numbers ${\displaystyle n}$ such that ${\displaystyle R_{n}(b)}$ is prime (some large terms are only corresponding to probable primes, these ${\displaystyle n}$ are checked up to 100000) OEIS sequence −50 1153, 26903, 56597, ... A309413 −49 7, 19, 37, 83, 1481, 12527, 20149, ... A237052 −48 2*, 5, 17, 131, 84589, ... A236530 −47 5, 19, 23, 79, 1783, 7681, ... A236167 −46 7, 23, 59, 71, 107, 223, 331, 2207, 6841, 94841, ... A235683 −45 103, 157, 37159, ... A309412 −44 2*, 7, 41233, ... A309411 −43 5, 7, 19, 251, 277, 383, 503, 3019, 4517, 9967, 29573, ... A231865 −42 2*, 3, 709, 1637, 17911, 127609, 172663, ... A231604 −41 17, 691, 113749, ... A309410 −40 53, 67, 1217, 5867, 6143, 11681, 29959, ... A229663 −39 3, 13, 149, 15377, ... A230036 −38 2*, 5, 167, 1063, 1597, 2749, 3373, 13691, 83891, 131591, ... A229524 −37 5, 7, 2707, 163193, ... A309409 −36 31, 191, 257, 367, 3061, 110503, ... A229145 −35 11, 13, 79, 127, 503, 617, 709, 857, 1499, 3823, 135623, ... A185240 −34 3, 294277, ... −33 5, 67, 157, 12211, ... A185230 −32 2* (no others) −31 109, 461, 1061, 50777, ... A126856 −30 2*, 139, 173, 547, 829, 2087, 2719, 3109, 10159, 56543, 80599, ... A071382 −29 7, 112153, 151153, ... A291906 −28 3, 19, 373, 419, 491, 1031, 83497, ... A071381 −27 (none) −26 11, 109, 227, 277, 347, 857, 2297, 9043, ... A071380 −25 3, 7, 23, 29, 59, 1249, 1709, 1823, 1931, 3433, 8863, 43201, 78707, ... A057191 −24 2*, 7, 11, 19, 2207, 2477, 4951, ... A057190 −23 11, 13, 67, 109, 331, 587, 24071, 29881, 44053, ... A057189 −22 3, 5, 13, 43, 79, 101, 107, 227, 353, 7393, 50287, ... A057188 −21 3, 5, 7, 13, 37, 347, 17597, 59183, 80761, 210599, 394579, ... A057187 −20 2*, 5, 79, 89, 709, 797, 1163, 6971, 140053, 177967, 393257, ... A057186 −19 17, 37, 157, 163, 631, 7351, 26183, 30713, 41201, 77951, 476929, ... A057185 −18 2*, 3, 7, 23, 73, 733, 941, 1097, 1933, 4651, 481147, ... A057184 −17 7, 17, 23, 47, 967, 6653, 8297, 41221, 113621, 233689, 348259, ... A057183 −16 3, 5, 7, 23, 37, 89, 149, 173, 251, 307, 317, 30197, 1025393, ... A057182 −15 3, 7, 29, 1091, 2423, 54449, 67489, 551927, ... A057181 −14 2*, 7, 53, 503, 1229, 22637, 1091401, ... A057180 −13 3, 11, 17, 19, 919, 1151, 2791, 9323, 56333, 1199467, ... A057179 −12 2*, 5, 11, 109, 193, 1483, 11353, 21419, 21911, 24071, 106859, 139739, 495953, ... A057178 −11 5, 7, 179, 229, 439, 557, 6113, 223999, 327001, ... A057177 −10 5, 7, 19, 31, 53, 67, 293, 641, 2137, 3011, 268207, ... A001562 −9 3, 59, 223, 547, 773, 1009, 1823, 3803, 49223, 193247, 703393, ... A057175 −8 2* (no others) −7 3, 17, 23, 29, 47, 61, 1619, 18251, 106187, 201653, 1178033, ... A057173 −6 2*, 3, 11, 31, 43, 47, 59, 107, 811, 2819, 4817, 9601, 33581, 38447, 41341, 131891, 196337, 1313371, ... A057172 −5 5, 67, 101, 103, 229, 347, 4013, 23297, 30133, 177337, 193939, 266863, 277183, 335429, 1856147, ... A057171 −4 2*, 3 (no others) −3 2*, 3, 5, 7, 13, 23, 43, 281, 359, 487, 577, 1579, 1663, 1741, 3191, 9209, 11257, 12743, 13093, 17027, 26633, 104243, 134227, 152287, 700897, 1205459, ... A007658 −2 3, 4*, 5, 7, 11, 13, 17, 19, 23, 31, 43, 61, 79, 101, 127, 167, 191, 199, 313, 347, 701, 1709, 2617, 3539, 5807, 10501, 10691, 11279, 12391, 14479, 42737, 83339, 95369, 117239, 127031, 138937, 141079, 267017, 269987, 374321, 986191, 4031399, ..., 13347311, 13372531, ... A000978 2 2, 3, 5, 7, 13, 17, 19, 31, 61, 89, 107, 127, 521, 607, 1279, 2203, 2281, 3217, 4253, 4423, 9689, 9941, 11213, 19937, 21701, 23209, 44497, 86243, 110503, 132049, 216091, 756839, 859433, 1257787, 1398269, 2976221, 3021377, 6972593, 13466917, 20996011, 24036583, 25964951, 30402457, 32582657, 37156667, 42643801, 43112609, ..., 57885161, ..., 74207281, ..., 77232917, ... A000043 3 3, 7, 13, 71, 103, 541, 1091, 1367, 1627, 4177, 9011, 9551, 36913, 43063, 49681, 57917, 483611, 877843, 2215303, ... A028491 4 2 (no others) 5 3, 7, 11, 13, 47, 127, 149, 181, 619, 929, 3407, 10949, 13241, 13873, 16519, 201359, 396413, 1888279, ... A004061 6 2, 3, 7, 29, 71, 127, 271, 509, 1049, 6389, 6883, 10613, 19889, 79987, 608099, ... A004062 7 5, 13, 131, 149, 1699, 14221, 35201, 126037, 371669, 1264699, ... A004063 8 3 (no others) 9 (none) 10 2, 19, 23, 317, 1031, 49081, 86453, 109297, 270343, ... A004023 11 17, 19, 73, 139, 907, 1907, 2029, 4801, 5153, 10867, 20161, 293831, ... A005808 12 2, 3, 5, 19, 97, 109, 317, 353, 701, 9739, 14951, 37573, 46889, 769543, ... A004064 13 5, 7, 137, 283, 883, 991, 1021, 1193, 3671, 18743, 31751, 101089, ... A016054 14 3, 7, 19, 31, 41, 2687, 19697, 59693, 67421, 441697, ... A006032 15 3, 43, 73, 487, 2579, 8741, 37441, 89009, 505117, 639833, ... A006033 16 2 (no others) 17 3, 5, 7, 11, 47, 71, 419, 4799, 35149, 54919, 74509, ... A006034 18 2, 25667, 28807, 142031, 157051, 180181, 414269, ... A133857 19 19, 31, 47, 59, 61, 107, 337, 1061, 9511, 22051, 209359, ... A006035 20 3, 11, 17, 1487, 31013, 48859, 61403, 472709, ... A127995 21 3, 11, 17, 43, 271, 156217, 328129, ... A127996 22 2, 5, 79, 101, 359, 857, 4463, 9029, 27823, ... A127997 23 5, 3181, 61441, 91943, 121949, ... A204940 24 3, 5, 19, 53, 71, 653, 661, 10343, 49307, 115597, 152783, ... A127998 25 (none) 26 7, 43, 347, 12421, 12473, 26717, ... A127999 27 3 (no others) 28 2, 5, 17, 457, 1423, 115877, ... A128000 29 5, 151, 3719, 49211, 77237, ... A181979 30 2, 5, 11, 163, 569, 1789, 8447, 72871, 78857, 82883, ... A098438 31 7, 17, 31, 5581, 9973, 101111, ... A128002 32 (none) 33 3, 197, 3581, 6871, 183661, ... A209120 34 13, 1493, 5851, 6379, 125101, ... A185073 35 313, 1297, ... 36 2 (no others) 37 13, 71, 181, 251, 463, 521, 7321, 36473, 48157, 87421, 168527, ... A128003 38 3, 7, 401, 449, 109037, ... A128004 39 349, 631, 4493, 16633, 36341, ... A181987 40 2, 5, 7, 19, 23, 29, 541, 751, 1277, ... A128005 41 3, 83, 269, 409, 1759, 11731, ... A239637 42 2, 1319, ... 43 5, 13, 6277, 26777, 27299, 40031, 44773, ... A240765 44 5, 31, 167, 100511, ... A294722 45 19, 53, 167, 3319, 11257, 34351, ... A242797 46 2, 7, 19, 67, 211, 433, 2437, 2719, 19531, ... A243279 47 127, 18013, 39623, ... A267375 48 19, 269, 349, 383, 1303, 15031, ... A245237 49 (none) 50 3, 5, 127, 139, 347, 661, 2203, 6521, ... A245442

* Repunits with negative base and even n are negative. If their absolute value is prime then they are included above and marked with an asterisk. They are not included in the corresponding OEIS sequences.

### Algebra factorization of generalized repunit numbers

If b is a perfect power (can be written as mn, 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 pr, with p prime, r integer, p, r >0), then all repunit in base b are not prime aside from Rp and R2. Rp 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 R2 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 R2 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 = −4k4, with k positive integer, which has the aurifeuillean factorization, for example, b = −4 (with k = 1, then R2 and R3 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 −4k4 with k positive integer, then there are infinity many base b repunit primes.

### The generalized repunit conjecture

A conjecture related to the generalized repunit primes:[11][12] (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 ${\displaystyle b}$)

For any integer ${\displaystyle b}$, which satisfies the conditions:

1. ${\displaystyle |b|>1}$.
2. ${\displaystyle b}$ is not a perfect power. (since when ${\displaystyle b}$ is a perfect ${\displaystyle r}$th power, it can be shown that there is at most one ${\displaystyle n}$ value such that ${\displaystyle {\frac {b^{n}-1}{b-1}}}$ is prime, and this ${\displaystyle n}$ value is ${\displaystyle r}$ itself or a root of ${\displaystyle r}$)
3. ${\displaystyle b}$ is not in the form ${\displaystyle -4k^{4}}$. (if so, then the number has aurifeuillean factorization)

has generalized repunit primes of the form

${\displaystyle R_{p}(b)={\frac {b^{p}-1}{b-1}}}$

for prime ${\displaystyle p}$, the prime numbers will be distributed near the best fit line

${\displaystyle Y=G\cdot \log _{|b|}\left(\log _{|b|}\left(R_{(b)}(n)\right)\right)+C,}$

where limit ${\displaystyle n\rightarrow \infty }$, ${\displaystyle G={\frac {1}{e^{\gamma }}}=0.561459483566...}$

${\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|)}}}$

base ${\displaystyle b}$ repunit primes less than ${\displaystyle N}$.

• ${\displaystyle e}$ is the base of natural logarithm.
• ${\displaystyle \gamma }$ is Euler–Mascheroni constant.
• ${\displaystyle \log _{|b|}}$ is the logarithm in base ${\displaystyle |b|}$
• ${\displaystyle R_{(b)}(n)}$ is the ${\displaystyle n}$th generalized repunit prime in base ${\displaystyle b}$ (with prime ${\displaystyle p}$)
• ${\displaystyle C}$ is a data fit constant which varies with ${\displaystyle b}$.
• ${\displaystyle \delta =1}$ if ${\displaystyle b>0}$, ${\displaystyle \delta =1.6}$ if ${\displaystyle b<0}$.
• ${\displaystyle m}$ is the largest natural number such that ${\displaystyle -b}$ is a ${\displaystyle 2^{m-1}}$th power.

We also have the following 3 properties:

1. The number of prime numbers of the form ${\displaystyle {\frac {b^{n}-1}{b-1}}}$ (with prime ${\displaystyle p}$) less than or equal to ${\displaystyle n}$ is about ${\displaystyle e^{\gamma }\cdot \log _{|b|}{\big (}\log _{|b|}(n){\big )}}$.
2. The expected number of prime numbers of the form ${\displaystyle {\frac {b^{n}-1}{b-1}}}$ with prime ${\displaystyle p}$ between ${\displaystyle n}$ and ${\displaystyle |b|\cdot n}$ is about ${\displaystyle e^{\gamma }}$.
3. The probability that number of the form ${\displaystyle {\frac {b^{n}-1}{b-1}}}$ is prime (for prime ${\displaystyle p}$) is about ${\displaystyle {\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.[13]

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 R16 and many larger ones. By 1880, even R17 to R36 had been factored[13] 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 R19 to be prime in 1916[14] and Lehmer and Kraitchik independently found R23 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. R317 was found to be a probable prime circa 1966 and was proved prime eleven years later, when R1031 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.

## Demlo numbers

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[15]. They are named after Demlo railway station 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[16], 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, ...