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.^{[1]}
A repunit prime is a repunit that is also a prime number. Primes that are repunits in base 2 are Mersenne primes.
Definition
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 base b representation. The first two repunits base b 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 base 10 starts with
Similarly, the repunits base 2 are defined as
Thus, the number R_{n}^{(2)} consists of n copies of the digit 1 in base 2 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 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)} = Template:Repeat = 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.
 Any positive multiple of the repunit R_{n}^{(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 pigeonhole 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 R_{1}^{(b)},...,R_{n}^{(b)}. Assume none of the R_{k}^{(b)} is divisible by n. Because there are n repunits but only n1 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. R_{j}^{(b)}  R_{i}^{(b)} consists of j  i ones followed by i zeroes. Thus, R_{j}^{(b)}  R_{i}^{(b)} = R_{ji}^{(b)} x b^{i} . Since n divides the lefthand side it also divides the righthand side and since n and b are relative prime n must divide R_{ji}^{(b)} contradicting the original assumption.
 The Feit–Thompson conjecture is that R_{q}^{(p)} never divides R_{p}^{(q)} for two distinct primes p and q.
Factorization of decimal repunits
(Prime factors colored red means "new factors", the prime factor divides R_{n} but not divides R_{k} for all k < n) (sequence A102380 in OEIS)



Smallest prime factor of R_{n} are
 1, 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 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)}:
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.
Decimal repunit primes
R_{n} is prime for n = 2, 19, 23, 317, 1031, ... (sequence A004023 in OEIS). R_{49081} and R_{86453} are probably prime. On April 3, 2007 Harvey Dubner (who also found R_{49081}) announced that R_{109297} is a probable prime.^{[2]} He later announced there are no others from R_{86453} to R_{200000}.^{[3]} On July 15, 2007 Maksym Voznyy announced R_{270343} to be probably prime,^{[4]} along with his intent to search to 400000. As of November 2012, all further candidates up to R_{2500000} have been tested, but no new probable primes have been found so far.
It has been conjectured that there are infinitely many repunit primes^{[5]} 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 (N1)th.
The prime repunits are a trivial subset of the permutable primes, i.e., primes that remain prime after any permutation of their digits.
Base 2 repunit primes
{{#invoke:mainmain}}
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 OEIS)
Base 4 repunit primes
The only base 4 repunit prime is 5 (). , and 3 always divides when n is odd and when n is even. For n greater than 2, both and are greater than 3, so removing the factor of 3 still leaves two factors greater than 1, so 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 OEIS)
Base 6 repunit primes
The first few base 6 repunit primes are
 7, 43, 55987, 7369130657357778596659, 3546245297457217493590449191748546458005595187661976371, 133733063818254349335501779590081460423013416258060407531857720755181857441961908284738707408499507 (sequence A165210 in OEIS)
Base 7 repunit primes
The first few base 7 repunit primes are
 2801, 16148168401, 85053461164796801949539541639542805770666392330682673302530819774105141531698707146930307290253537320447270457,
138502212710103408700774381033135503926663324993317631729227790657325163310341833227775945426052637092067324133850503035623601
Base 8 and 9 repunit primes
The only base 8 or base 9 repunit prime is 73 (). , and 7 divides when n is not divisible by 3 and when n is a multiple of 3. , and 2 always divides both and .
Base 12 repunit primes
The first few base 12 repunit primes are
 13, 157, 22621, 29043636306420266077, 435700623537534460534556100566709740005056966111842089407838902783209959981593077811330507328327968191581, 388475052482842970801320278964160171426121951256610654799120070705613530182445862582590623785872890159937874339918941
Base 20 repunit primes
The first few base 20 repunit primes are
 421, 10778947368421, 689852631578947368421
The smallest repunit prime (p>2) of any natural number base b
The list is about all bases up to 300. (sequence A128164 in OEIS)
Base  +1  +2  +3  +4  +5  +6  +7  +8  +9  +10  +11  +12  +13  +14  +15  +16  +17  +18  +19  +20 
0+  3  3  3  None  3  3  5  3  None  19  17  3  5  3  3  None  3  25667  19  3 
20+  3  5  5  3  None  7  3  5  5  5  7  None  3  13  313  None  13  3  349  5 
40+  3  1319  5  5  19  7  127  19  None  3  4229  103  11  3  17  7  3  41  3  7 
60+  7  3  5  None  19  3  19  5  3  29  3  7  5  5  3  41  3  3  5  3 
80+  None  23  5  17  5  11  7  61  3  3  4421  439  7  5  7  3343  17  13  3  None 
100+  3  59  19  97  3  149  17  449  17  3  3  79  23  29  7  59  3  5  3  5 
120+  None  5  43  599  None  7  5  7  5  37  3  47  13  5  1171  227  11  3  163  79 
140+  3  1231  3  None  5  7  3  1201  7  3  13  >10000  3  5  3  7  17  7  13  7 
160+  3  3  7  3  5  137  3  3  None  17  181  5  3  3251  5  3  5  347  19  7 
180+  17  167  223  >10000  >10000  7  37  3  3  13  17  3  5  3  11  None  31  5  577  >10000 
200+  271  37  3  5  19  3  13  5  3  >10000  41  11  137  191  3  None  281  3  13  7 
220+  7  5  239  11  None  127  5  461  11  5333  3  953  113  61  7  3  7  7  5  109 
240+  17  19  None  3331  3  3  17  41  5  127  7  541  19  5  5  None  23  11  2011  5 
260+  31  197  5  7  5  3  13  11  >10000  241  41  3  37  5  5  31  5  3  3  7 
280+  >10000  7  29  2473  5  13  3  3  None  3  13  5  3  7  17  41  17  53  113  7 
There are only probable primes for that b = 18, 51, 91, 96, 174, 230, 244, 259, and 284.
No known repunit primes or PRPs for that b = 152, 184, 185, 200, 210, 269, and 281.
Because of the algebra factorization, there are no repunit primes for that b = 4, 9, 16, 25, 32, 36, 49, 64, 81, 100, 121, 125, 144, 169, 196, 216, 225, 243, 256, and 289. (sequence A126589 in OEIS)
It is expected that all odd primes are in the list.
For negative bases (up to −300), see Wagstaff prime.
The smallest natural number base b that is prime for prime p
The list is about the first 100 primes. (sequence A066180 in OEIS)
p  2  3  5  7  11  13  17  19  23  29  31  37  41  43  47  53  59  61  67  71 
min b  2  2  2  2  5  2  2  2  10  6  2  61  14  15  5  24  19  2  46  3 
p  73  79  83  89  97  101  103  107  109  113  127  131  137  139  149  151  157  163  167  173 
min b  11  22  41  2  12  22  3  2  12  86  2  7  13  11  5  29  56  30  44  60 
p  179  181  191  193  197  199  211  223  227  229  233  239  241  251  257  263  269  271  277  281 
min b  304  5  74  118  33  156  46  183  72  606  602  223  115  37  52  104  41  6  338  217 
p  283  293  307  311  313  317  331  337  347  349  353  359  367  373  379  383  389  397  401  409 
min b  13  136  220  162  35  10  218  19  26  39  12  22  67  120  195  48  54  463  38  41 
p  419  421  431  433  439  443  449  457  461  463  467  479  487  491  499  503  509  521  523  541 
min b  17  808  404  46  76  793  38  28  215  37  236  59  15  514  260  498  6  2  95  3 
The values of b that are perfect powers do not appear in this list, because they cannot be the base of a generalized repunit prime.^{[6]}
List of repunit primes base b
b  n which is prime (some large terms are only PRP, these n's are checked up to 100000)  OEIS sequence 
−30  2, 139, 173, 547, 829, 2087, 2719, 3109, 10159, 56543, 80599, ...  A071382 
−29  7, ...  
−28  3, 19, 373, 419, 491, 1031, 83497, ...  A071381 
−27  None (Algebra)  
−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, ...  A057187 
−20  2, 5, 79, 89, 709, 797, 1163, 6971, 140053, 177967, ...  A057186 
−19  17, 37, 157, 163, 631, 7351, 26183, 30713, 41201, 77951, ...  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, ...  A057179 
−12  2, 5, 11, 109, 193, 1483, 11353, 21419, 21911, 24071, 106859, 139739, ...  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, ...  A057175 
−8  2 (Algebra)  
−7  3, 17, 23, 29, 47, 61, 1619, 18251, 106187, 201653, ...  A057173 
−6  2, 3, 11, 31, 43, 47, 59, 107, 811, 2819, 4817, 9601, 33581, 38447, 41341, 131891, 196337, ...  A057172 
−5  5, 67, 101, 103, 229, 347, 4013, 23297, 30133, 177337, 193939, 266863, 277183, 335429, ...  A057171 
−4  2, 3 (Aurifeuillean factorization)  
−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, ...  A007658 
−2  3, 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, ... (1 is not prime)  A000978 
−1  None (1 is not prime)  
0  None (1 is not prime)  
1  2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, ... (All primes)  A000040 
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, ...  A000043 
3  3, 7, 13, 71, 103, 541, 1091, 1367, 1627, 4177, 9011, 9551, 36913, 43063, 49681, 57917, 483611, 877843, ...  A028491 
4  2 (Algebra)  
5  3, 7, 11, 13, 47, 127, 149, 181, 619, 929, 3407, 10949, 13241, 13873, 16519, 201359, 396413, ...  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 (Algebra)  
9  None (Algebra)  
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, ...  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, ...  A006032 
15  3, 43, 73, 487, 2579, 8741, 37441, 89009, ...  A006033 
16  2 (Algebra)  
17  3, 5, 7, 11, 47, 71, 419, 4799, 35149, 54919, 74509, ...  A006034 
18  2, 25667, 28807, 142031, 157051, 180181, ...  A133857 
19  19, 31, 47, 59, 61, 107, 337, 1061, 9511, 22051, 209359, ...  A006035 
20  3, 11, 17, 1487, 31013, 48859, 61403, ...  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, ...  A204940 
24  3, 5, 19, 53, 71, 653, 661, 10343, 49307, ...  A127998 
25  None (Algebra)  
26  7, 43, 347, 12421, 12473, 26717, ...  A127999 
27  3 (Algebra)  
28  2, 5, 17, 457, 1423, ...  A128000 
29  5, 151, 3719, 49211, 77237, ...  A181979 
30  2, 5, 11, 163, 569, 1789, 8447, 72871, 78857, 82883, ...  A098438 
For more information, see Repunit primes in base −50 to 50, Repunit primes in base 2 to 150, Repunit primes in base −150 to −2, and Repunit primes in base −200 to −2.
Algebra factorization of 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 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 letter 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.
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.^{[7]}
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^{[8]} 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^{[9]} 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
The {{safesubst:#invoke:anchormain}} Demlo numbers^{[10]} 1, 121, 12321, 1234321, ..., 12345678987654321, 1234567900987654321, 123456790120987654321, ..., (sequence A002477 in OEIS) were defined by D. R. Kaprekar as the squares of the repunits, resolving the uncertainty how to continue beyond the highest digit (9), and named after Demlo railway station 30 miles from Bombay on the then G.I.P. Railway, where he thought of investigating them.
See also
 Repdigit
 Recurring decimal
 All one polynomial  Another generalization
 Goormaghtigh conjecture
 Wagstaff prime  can be thought of as repunit primes with negative base
Notes
 ↑ {{#invoke:citation/CS1citation CitationClass=book }}
 ↑ Harvey Dubner, New Repunit R(109297)
 ↑ Harvey Dubner, Repunit search limit
 ↑ Maksym Voznyy, New PRP Repunit R(270343)
 ↑ Chris Caldwell, "The Prime Glossary: repunit" at The Prime Pages.
 ↑ {{#invoke:citation/CS1citation CitationClass=citation }}.
 ↑ Dickson, Leonard Eugene and Cresse, G.H.; History of the Theory of Numbers; pp. 164167 ISBN 0821819348
 ↑ Dickson and Cresse, pp. 164167
 ↑ Francis, Richard L.; "Mathematical Haystacks: Another Look at Repunit Numbers" in The College Mathematics Journal, Vol. 19, No. 3. (May, 1988), pp. 240246.
 ↑ Weisstein, Eric W., "Demlo Number", MathWorld.
External links
Web sites
 Weisstein, Eric W., "Repunit", MathWorld.
 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.
 Generalized repunit primes in base 50 to 50
Books
 S. Yates, Repunits and repetends. ISBN 0960865209.
 A. Beiler, Recreations in the theory of numbers. ISBN 0486210960. Chapter 11.
 Paulo Ribenboim, The New Book Of Prime Number Records. ISBN 0387944575.
Template:Classes of natural numbers Template:Prime number classes