The primes hidden in a row of ones
Worth reading first: One residue whose powers are all of them · How often two generates every remainder.
The numbers are called repunits, a word coined by Albert Beiler in 1966 for “repeated unit”. Write for the one with ones. They look like a curiosity of writing numbers in base ten — the same curiosity that asks how few ones can build a number by sums and products — and in a sense they are: in base two the same idea gives , the numbers one less than a power of two, whose prime members are the Mersenne primes. But the questions they raise are not curiosities. Which primes divide ? Does every have a prime factor that no shorter repunit has? When is itself prime?
The first question has a complete answer, and it is in a place that looks unrelated. A prime other than 2, 3 and 5 divides exactly when the decimal expansion of repeats in blocks whose length divides . So the primes dividing the repunits are governed by the periods of fractions, and the periods of fractions are governed by the order of 10 among the remainders — the same quantity Fermat’s little theorem is a statement about. The second question also has an answer, a theorem from the nineteenth century, and the new primes it promises have a recognisable shape. The third question has only a list, five entries long, and a heuristic that says the list never ends.
Every prime keeps its own beat
The figure tests every prime from 3 to 103 against every repunit with up to 48 ones. Read along a row and the dots fall at a regular beat. Seven divides and every sixth repunit after it; 41 divides every fifth; 101 every fourth; 11 every second. The primes 2 and 5 never appear, since a repunit ends in 1. And some rows are empty in the range shown — 59 first divides , 61 first divides — because their beats are longer than 48.
The reason is a two-line calculation. Since , a prime other than 3 divides exactly when it divides , which is to say when . The smallest positive with that property is the order of 10 modulo , call it , and holds exactly when is a multiple of . So divides exactly the repunits whose length is a multiple of , and nothing else, which is the beat in the figure. The figure checks the rule at every one of its 1,200 cells.
The order has a familiar face. Long division of 1 by produces remainders modulo , and the decimal digits repeat as soon as a remainder repeats, which first happens when . So is the length of the repeating block of : has period 6, and . Every prime’s beat in the figure is the length of its reciprocal’s repeating block, and the prime 3, the exception, divides exactly when 3 divides , by the rule that a number is divisible by 3 when its digit sum is.
A repunit built from its divisors
The beats interlock, and the interlocking has an algebraic name. The polynomial factors over the integers as the product of the cyclotomic polynomials for the divisors of — the polynomials whose roots are the primitive -th roots of unity, each of them irreducible. Putting and dividing by gives
The figure draws each repunit up to as a row of blocks, one for each divisor , each as wide as the number of digits of . is , where , and ; and indeed . The figure checks the product for every row.
Two consequences can be read off the rows. First, divides whenever divides , because the blocks of are among the blocks of — so can be prime only when is prime, when the row consists of a single block. Second, the last block of each row, , is where everything new about lives: a prime dividing but no shorter repunit has order exactly , and every such prime divides . The rows of the first figure and the rows of this one are the same information arranged by prime and by repunit.
Something new at every length
Does every repunit bring a new prime? The figure factors for every from 2 to 36 and finds at least one new prime each time: 11 at , 37 at 3, 101 at 4, 41 and 271 at 5, 7 and 13 at 6, and so on up to the twelve-digit prime at 36. That this never fails is a theorem. A. S. Bang proved in 1886, and Karl Zsigmondy in general in 1892, that has a prime factor dividing no with , for every and , apart from two small families of exceptions — a power of 2 with , and with . Base 10 avoids both, so every repunit from on has a prime of its own.
The new primes have a shape. A prime new to has order exactly , and by Fermat’s little theorem , so divides : every new prime of is one more than a multiple of . The figure checks it: and , the two new primes of ; and , both . The only factors of that are not new are 3 (at ) and 11 (at ), and both divide their index — the familiar exception in cyclotomic factorisations, where a prime dividing can sit in without being primitive.
Put together, the two facts prove something about primes in general. For every there is a prime that is one more than a multiple of , since supplies one; applying this to gives infinitely many. That is the case of Dirichlet’s theorem on primes in arithmetic progressions with remainder 1 — one of the cases that can be proved by elementary means, and here it falls out of a row of ones.
The length of the repeating block
The order of 10 modulo always divides , which is Fermat’s theorem again, so the period of is or a half, a third, a quarter of it, and so on. The figure plots the period against for every prime from 7 to 400, and the points line up on the rays through the origin with slopes . A prime on the top ray, with period , divides no repunit shorter than ; such primes — 7, 17, 19, 23, 29, 47, … — are those for which 10 is a primitive root, and their reciprocals have the longest possible repeating block, cycling through every non-zero remainder. Twenty-nine of the 75 primes in the range are of this kind.
What share of all primes have 10 as a primitive root? Emil Artin conjectured in 1927 that for any base that is not a perfect power and not of a special form, the share is a fixed constant, about , and the counts for base 2 settle onto it in how often two generates every remainder. Base 10 behaves the same way. The conjecture is still unproved for any single base: Christopher Hooley proved it in 1967 assuming the generalised Riemann hypothesis, and unconditionally Roger Heath-Brown showed in 1986 that at most two prime bases can fail to be primitive roots infinitely often — a theorem that says nothing about 10, which is not prime. Nobody can prove that 10 is a primitive root for infinitely many primes — which is to say, that there are infinitely many primes whose reciprocals have the longest possible repeating block.
The figure also shows how rarely the period is short. Points near the bottom — periods of a twentieth of or less — are few, and they belong to primes dividing short repunits with many factors: 37 has period 3, 101 has period 4, 41 and 271 have period 5. A prime with period divides , a number with about digits, and such a number can only have a few prime factors. Short periods are scarce for the plain reason that short repunits are small.
The block of 1/7, multiplied
The full-period primes have a property that makes their repunits visible in a different way. Since 7 has period 6, it divides , and is the repeating block of . Multiply that block by 2, 3, 4, 5 and 6 and the answers are , , , and — the same six digits, turned round a circle. Numbers with this property are called cyclic numbers, and the reason it happens is the long division. The fraction for from 1 to 6 begins its expansion at the remainder , and because 7 has the full period, every non-zero remainder occurs somewhere in the cycle that 1/7 runs through. So each is entered at a different point of the same cycle, and its block is a rotation of the same block.
The same holds for every prime with the full period: 17 gives a sixteen-digit cyclic number, 19 an eighteen-digit one. It fails for primes with a shorter period, such as 13, whose twelve remainders split into two cycles of six, so that the multiples of are rotations of either or and never of both. The picture is the one that proves Fermat’s theorem itself in necklaces that prove a theorem: the non-zero remainders fall into orbits of equal length under multiplication by 10, the length of each orbit is the period, and so the period divides the number of remainders, . A full-period prime has one orbit, a necklace of all beads, and that necklace is the cyclic number.
Seen this way, a prime divides when is a whole number of trips round its necklace, and the primes new to are those whose necklaces have exactly beads. The repunit grid is a table of necklace lengths, one prime per row. The cyclotomic factorisation, for all its algebraic appearance, is the same statement as the one about necklaces: the factorisation into primes being unique, each prime goes into exactly one block, the block of its period.
When the row of ones is itself prime
The blocks showed that can be prime only when is prime. The converse fails at once: , , . The figure tests every prime length up to 1,100 with the Miller–Rabin test, a sharpening of the Fermat test that Carmichael numbers fool in every base and that nothing fools in every base — the probabilistic test whose bound of a quarter on the liars makes a passing number overwhelmingly likely to be prime — and retests the survivors with twelve bases. Of the 184 prime lengths, exactly five give a prime: , , , and .
These five are proved prime, not merely probably prime: and early in the twentieth century, by Hugh Williams in 1978, and by Williams and Harvey Dubner in 1986, using primality proofs that exploit the factorisation of . The test in the figure is evidence rather than proof for the larger two; what it can certify is the other direction, since a number that fails Miller–Rabin is certainly composite. Every one of the 179 failures is a proof of compositeness, typically without a single factor being known.
The scarcity is part of a pattern familiar from the Mersenne numbers , which can also be prime only at prime exponents and are prime at only a few of them. In both cases the only easy obstruction — a factorisation inherited from a divisor of — is removed by taking prime, and what is left is the ordinary scarcity of primes among large numbers, somewhat relieved by the constraint that any prime factor must be one more than a multiple of .
Five proved, six more found, and a count
Beyond 1,031, the known prime repunits are at lengths 49,081, 86,453, 109,297, 270,343, 5,794,777 and 8,177,207, found by long computer searches and confirmed by probable-prime tests; the largest have millions of digits. The figure plots the count of known prime repunits of length up to on a logarithmic scale against a heuristic prediction.
The heuristic treats , for prime , as a random number of its size, about , adjusted for the fact that every prime factor of must be one more than a multiple of — which rules out all the small primes that usually make a random number composite. The adjustment raises the chance of primality, and the calculation, carried out by Samuel Wagstaff for the Mersenne numbers and transferred to base ten, predicts about prime repunits of length at most . At that is about 12.5, against 11 known; at it is about 5.4, against 5. The staircase and the line agree as well as such counts ever do.
The heuristic predicts that the staircase climbs for ever, by about 1.8 steps each time the lengths are multiplied by ten. Nobody can prove that there are more than five prime repunits, or even that there are infinitely many composite repunits of prime length with some particular property. The same is true of the Mersenne primes, where the prediction and the open question are identical in form.
What the beats cannot show
The figures show divisibility, not factors. The grid of dots tells which primes up to 103 divide which repunits, but a repunit’s largest prime factors are usually far larger than anything in the grid: has a twenty-digit prime factor, and factoring for large is a serious computational problem. The factorisation tables of repunits — maintained for decades because they are the hardest test cases for factoring algorithms with a cyclotomic head start — run to a few hundred digits and then stop, with many composite cofactors whose factors nobody knows.
The figures also cannot show the reason the beat of a prime is what it is. The period of is computed by running long division until a remainder repeats, which is quick for one prime and gives no formula for the next. No rule predicts from alone whether 10 is a primitive root, which is why Artin’s conjecture is a conjecture; the figure’s 29 out of 75 is a count, and the constant it approaches is a heuristic.
And the primality figure, like the heuristic figure, rests partly on other people’s computations. The five small prime repunits were tested here; the six large ones were not, and they appear because their discoverers reported them, with probable-prime certificates that no figure here reproduces.
Still open: infinitely many prime rows of ones
Are there infinitely many prime repunits? The heuristic says yes, at a rate of about up to , and there is no proof. Nor is it proved that infinitely many with prime are composite — almost certainly almost all of them are, and in the Mersenne case the corresponding statement would follow from the infinitude of primes with also prime, which is itself unproved. The repunit case is not merely analogous to the Mersenne case; the same method of heuristic and the same ignorance apply to in every base , and in no base is the infinitude settled.
Other questions sit nearby. A prime whose square divides the repunit of its own period is a base-10 analogue of a Wieferich prime, and such primes exist: 3, 487 and 56,598,313 are known, with dividing . Whether there are infinitely many is open, and so, in the other direction, is whether infinitely many primes escape — the analogous question for Mersenne numbers, whether is squarefree for every prime , is open too. And whether 10 is a primitive root modulo infinitely many primes is Artin’s conjecture for base 10, unproved without the generalised Riemann hypothesis.
What the repunits show is how much of a number’s arithmetic is fixed by structure and how much is left to chance. Which primes divide , at which lengths, and with what residues, is all forced by the cyclotomic factorisation and Fermat’s theorem. Whether the one block of happens to be prime is not forced by anything known.
The beat of a reciprocal
A prime other than 3 divides the repunit exactly when the repeating block of has a length dividing — so each prime divides the repunits at a steady beat, 7 and 13 every sixth, 41 every fifth, 101 every fourth. Each repunit is the product of the cyclotomic values over its divisors , so divides when divides , and the block holds exactly the primes new to ; by Bang and Zsigmondy there is always at least one, and every one is one more than a multiple of , apart from 3 and 11, which divide their own index. The period of divides , and 29 of the 75 primes from 7 to 400 have the full period. A repunit can be prime only at a prime length, and among the 184 prime lengths to 1,100 it is prime only at 2, 19, 23, 317 and 1,031; eleven prime repunits are known in all, close to the heuristic , and whether there are infinitely many is open.
Shares its objects with
Essays that name at least two of the same things, and that neither author linked.
- Every power sum, from the coefficients alone — both name fermats little theorem, primality test
- Fair in base two and not in base six — both name decimal expansion, multiplicative order
- The row that proves a prime — both name fermats little theorem, primality test
- Two primes where Fermat holds twice — both name fermats little theorem, heuristic
Named objects
A dashed tag is an object no other essay names yet.
Cyclotomic polynomialDecimal expansionFermats little theoremHeuristicMersenne primeMultiplicative orderPrimality test