Books · Monthly Mindbenders: Solutions
Chapter 9
A Multiple Made of Ones
A pigeonhole puzzle from the Monthly Mindbenders.1
Problem
Prove that your ten-digit telephone number, if it ends in , , or , has a multiple that, written out in base ten, is nothing but a string of s.
Solution
Call the number , and write for the number made of ones, so , , and so on. These are the repunits. The claim is that divides one of them.
The only thing the last digit tells us is that is odd and not a multiple of , so it shares no factor with . That, it turns out, is all the proof needs. The ten digits are decoration: the argument works for every whole number that shares no factor with .
Consider the first repunits, , and their remainders on division by . There are only possible remainders, from to , and there are repunits, so two of them leave the same remainder. Say and , with . Their difference is then a multiple of , and it has a very particular shape. Subtracting ones from ones leaves ones followed by zeros, so For instance . So divides . But shares no factor with , and so none with , which means every factor of must be found in . Hence divides .
Why the last digit is exactly the right condition
Every repunit ends in , so every repunit is odd and none is a multiple of . A number ending in , , , , or has a factor of or and can therefore divide no repunit at all. So the puzzle’s condition marks exactly the dividing line, both sufficient and necessary.
A tempting shortcut, and where it breaks
There is a quicker-looking route. Since shares no factor with , some power of ten leaves remainder on division by , say . Then divides , and it is natural to conclude that divides .
That last step fails whenever is a multiple of . Take : already leaves remainder , so divides , but does not divide . The true answer for is . The factor can soak up some or all of the threes in , and dividing it away loses them.
The shortcut can be repaired by asking instead for a power of ten that leaves remainder on division by , which also exists. The pigeonhole argument above never needs repairing, because it never divides by anything: it works with the repunits directly.
How long the string is
The same reasoning pins down the shortest string exactly. The repunit equals , so divides precisely when divides . The shortest such is the smallest power for which leaves remainder on division by , the multiplicative order of modulo .
For a ten-digit number this is enormous. Taking as an example, the shortest string of ones that it divides has digits, and that is on the short side: across random ten-digit numbers ending in , , or the median length is about million, and only one in seventeen needs fewer than a million ones. The pigeonhole argument promises at most ones, a few billion, and the true figure is usually well inside that bound while still far too long to write out.
The computation
The check takes numbers ending in , , or . They are the small awkward cases , , , and , the example above, and random ten-digit numbers, of them multiples of . For each, it finds the multiplicative order of modulo and confirms that leaves remainder on division by . That is the same as dividing . The small cases get a second, slower check that walks the repunits one at a time, updating the remainder as , and finds the first repunit divisible by at exactly the th.
import sympy as sp
def first_repunit(N):
"""walk R_1, R_2, ... modulo N; return the first k with N | R_k"""
if N % 2 == 0 or N % 5 == 0:
return None
r = 0
for k in range(1, N + 2):
r = (10 * r + 1) % N
if r == 0:
return k
for N in (3, 9, 27, 81, 37):
assert first_repunit(N) == sp.n_order(10, 9 * N)
N = 2125550171
k = sp.n_order(10, 9 * N)
print(k, pow(10, k, 9 * N) == 1) # 8334000 True
print(first_repunit(15), first_repunit(22)) # None None
Every one of the numbers has a repunit multiple, including all multiples of , and the numbers ending in or an even digit correctly have none. The one pitfall in writing the check is instructive: building itself as a number, with in the millions, takes far longer than it should, and the powers must be taken modulo instead.
Peter Winkler, Monthly Mindbenders, National Museum of Mathematics, September 2026, momath.org/mindbenders.↩︎