You are on page 1of 6

Pigeonholes and Repunits

Author(s): Chai Wah Wu


Source: The American Mathematical Monthly, Vol. 121, No. 6 (June–July), pp. 529-533
Published by: Mathematical Association of America
Stable URL: http://www.jstor.org/stable/10.4169/amer.math.monthly.121.06.529 .
Accessed: 30/05/2014 15:08

Your use of the JSTOR archive indicates your acceptance of the Terms & Conditions of Use, available at .
http://www.jstor.org/page/info/about/policies/terms.jsp

.
JSTOR is a not-for-profit service that helps scholars, researchers, and students discover, use, and build upon a wide range of
content in a trusted digital archive. We use information technology and tools to increase productivity and facilitate new forms
of scholarship. For more information about JSTOR, please contact support@jstor.org.

Mathematical Association of America is collaborating with JSTOR to digitize, preserve and extend access to
The American Mathematical Monthly.

http://www.jstor.org

This content downloaded from 173.81.62.55 on Fri, 30 May 2014 15:08:30 PM


All use subject to JSTOR Terms and Conditions
NOTES
Edited by Sergei Tabachnikov

Pigeonholes and Repunits


Chai Wah Wu

Abstract. It is well known that any integer k has a multiple consisting of only the digits 1 and
0. As an extension of this result, we study integers of the form 111 · · · 000 or 111 · · · 111 that
are a multiple of k. We show that if k > 2 and k is not a power of 3, then the multiple can be
chosen to have at most k − 1 digits.

1. INTRODUCTION. A wonderful exercise problem illustrates the application of


the Pigeonhole principle: show that any integer has a (positive) multiple consisting
only of the digits 0 and 1. At first glance, this looks like a hard problem, but using the
Pigeonhole principle leads to a simple proof.

Definition 1. An integer of the form 111 · · · 111 is called a repunit. A repunit of i


digits is denoted as
i−1
X 10i − 1
R(i) = 10s = .
s=0
9

Theorem 1. For any positive integer k, there exists a positive number n of at most k
digits that consists only of the digits 0 and 1 and is a multiple of k.

Proof. Consider the set of k repunits {1, 11, 111, . . . , } which we denote as S. Con-
sider the remainders of these k numbers when divided by k. If 0 is among them, we
have found a multiple of k. If 0 is not among them, these remainders take on values
from 1 to k − 1. Since there are k of them, by the Pigeonhole principle, two of these re-
mainders must be equal. Hence, the difference between the two repunits corresponding
to these two remainders, which is of the form 1 · · · 10 · · · 0, must be a multiple of k.

Because all numbers in S are repunits, the multiple of k that is found always consists
of a sequence of 1’s followed by zero or more 0’s. The same proof also applies if S is
a sequence of k numbers consisting of 0’s and 1’s, such that the pattern of 1’s in each
member of S is a subpattern of the next number in S. For instance, the set of numbers
in S could be:
0001000
0001100
0011100
0011110
0111110
1111110
1111111.
http://dx.doi.org/10.4169/amer.math.monthly.121.06.529
MSC: Primary 11A05, Secondary 11A51; 97E60

June–July 2014] NOTES 529

This content downloaded from 173.81.62.55 on Fri, 30 May 2014 15:08:30 PM


All use subject to JSTOR Terms and Conditions
By picking these bitpatterns appropriately, the same argument can be used to prove
the following.

Theorem 2. For any integers k ≥ 1 and t ≥ 0, there exists a number n consisting of


only the digits 0 and 1, such that n is a multiple of k, and the 1’s in n are at least t
digits apart.

As an example, consider the case of k = 7, t = 2. By picking the numbers in S


to be

1,
1001,
1001001,
1001001001,
1001001001001,
1001001001001001,
1001001001001001001,

we find that 1001, 1001001001, and 1001001001001001 are all divisible by 7.

2. NUMBERS OF THE FORM 111 · · · 000 AND 111 · · · 111 THAT ARE MUL-
TIPLES OF k. In this section, we will prove Theorem 1 in another (more compli-
cated) way, but the proof provides additional insights on the number of 1’s and 0’s in
this multiple of k. We first need the following Lemma.

Lemma 1. For nonnegative integers r and m, there exists a multiple of 3r , consisting


of the digits 0 and 1 only, such that the number of 1’s is 3r with each pair of 1’s
separated by m zeros.

Proof. We prove this by induction on r . This is trivially true for r = 0. Suppose it is


true for 3r −1 . Then there is a multiple of 3r −1 of the form indicated, which we denote
as t0 . The number t0 has 3r −1 + (3r −1 − 1)m digits. Consider the number t1 written as
the digit 1 followed by s zeros followed by a 1 followed by s zeros followed by a 1.
The sum of the digits of this number t1 is 3, and thus t1 is divisible by 3. Now, let the
number s be defined as 3r −1 (m + 1) − 1. Then clearly t0 t1 is a multiple of 3r , and it is
easy to see that t0 t1 is of the required form.

Lemma 2. Suppose a and 10 are relatively prime, R(n) is a multiple of a, and m > n.
If m is a multiple of n, then R(m) is a multiple of a. If R(m) is a multiple of a,
then R(gcd(m, n)) is a multiple of a. If in addition, n is the smallest positive integer
such that R(n) is a multiple of a, then R(m) is a multiple of a if and only if m is a
multiple of n.

Proof. If m is a multiple of n, then R(m) clearly is a multiple of R(n), so R(m) is


a multiple of a. Suppose that R(m) is a multiple of a. Then R(m) − R(n) = R(m −
n)10n is a multiple of a. Since a and 10 are relatively prime, R(m − n) is a multiple of
a. Repeating this several times, we are essentially reducing m and n via the Euclidean
algorithm until we reach the conclusion that R(gcd(m, n)) is a multiple of a. Suppose
that n is the smallest positive integer such that R(n) is a multiple of a and m > n
is not a multiple of n. The same approach shows that R(r ) is a multiple of a, where
0 < r < n is the remainder of m mod n, a contradiction.

530 c THE MATHEMATICAL ASSOCIATION OF AMERICA [Monthly 121


This content downloaded from 173.81.62.55 on Fri, 30 May 2014 15:08:30 PM


All use subject to JSTOR Terms and Conditions
Lemma 3. If gcd(3, m) = 1 and 3s divides R(3r m), then s ≤ r .

Proof. We prove this by induction on r . For r = 0, the divibility test for divisor 3
shows that 3 does not divide R(m). Assume that the result is true for r = n. Suppose
n n
3s divides R(3n+1 m). Note that R(3n+1 m) = R(3n m)t, where t = 102·3 m + 103 m + 1.
Since t is not divisible by 9, this implies that 3s−1 divides R(3n m), implying s − 1 ≤ n
and s ≤ n + 1.

Lemma 4. A repunit R(n) is a multiple of 3r if and only if 3r divides n.

Proof. If 3r divides n, then clearly 3r divides R(n) by Lemma 1. Suppose R(n) is a


multiple of 3r and n is not a multiple of 3r . Let m be the smallest positive integer
such that 3r divides R(m). Since 3r divides R(3r ) by Lemma 1, by Lemma 2, m di-
vides 3r . By Lemma 3, m = 3r . By Lemma 2, n is a multiple of m = 3r , which is a
contradiction.

Definition 2. Let T denote the subset of positive integers consisting of only 0’s and
1’s, where each element of T is of the form 111 · · · 000 or 111 · · · 111, i.e., elements
in T are of the form R(a)10b , a ≥ 1, b ≥ 0.

Theorem 3. Consider a positive integer k factored as k = 2 p 5q 3r m, where m ≥


1 does not contain 2, 3, or 5 as a factor. Let g(m) be the multiplicative order of
10 mod m, i.e., g(m) is the smallest positive number a such that 10a ≡ 1 mod m
(see http://oeis.org/A002329). Let u = max( p, q), and w = lcm(3r , g(m)). A
number in T with a 1’s and b 0’s is a multiple of k if w divides a and u ≤ b.

Proof. Note that m divides 10g(m) − 1 = 9R(g(m)). Since 3 is not a factor of m, m di-
vides R(g(m)). Next, let 3v = gcd(3r , g(m)). 3v divides R(g(m)) (see Lemma 1) and
thus 3v m divides R(g(m)). By Lemma 1, there exists a multiple of 3r −v that contains
3r −v 1’s, with each pair of 1’s separated by g(m) − 1 zeros. Since w = 3r −v g(m), mul-
tiplying this number by R(g(m)) equals R(w) and this shows that R(w) is a multiple
of 3r m. Since 3r m10u is a multiple of k, this implies that R(w)10u ∈ T is a multiple
of k that consists of only 1’s and 0’s. Thus we have shown that the integer in T with w
1’s and u 0’s is a multiple of k. Then clearly, a number in T with the number of 1’s a
multiple of w and the number of 0’s larger than u is also a multiple of k.

Note that m and 10 are relatively prime, and by Euler’s theorem, g(m) ≤ φ(m),
where φ is Euler’s totient function. The integer R(w)10u is of length ` = u +
3r −v g(m) ≤ u + 3r −v φ(m) ≤ u + 3r m. If we looked at the smallest integer con-
sisting of the digits 1 and 0 that is a multiple of k, then it can be shorter than `
digits (see http://oeis.org/A004290). For instance, 1001 is a multiple of 13, even
though ` = 6 in this case. It is still an open problem what the characterization of the
sequence http://oeis.org/A004290 is. The following Lemma shows that ` ≤ k,
thus providing another proof of Theorem 1.

Lemma 5. With u, r , and m as defined above, u + 3r m ≤ k.

Proof. If u = 0, then p = q = 0 and u + 3r m = 3r m = k. If u = 1, then u + 3r m =


1 + 3r m ≤ 2 · 3r m ≤ k. If u > 1, then 2 p 5q ≥ 2u > u + 1 and k > (u + 1)3r m ≥
u + 3r m.

June–July 2014] NOTES 531

This content downloaded from 173.81.62.55 on Fri, 30 May 2014 15:08:30 PM


All use subject to JSTOR Terms and Conditions
If k = 1, then the smallest positive number with the digits 1 and 0 that is a multiple
of k is 1, i.e., it has length k = 1. If k = 2, then the smallest such number is 10, i.e.,
it has length k = 2. If k = 3r , then a multiple of k of the form m10a implies that m is
a multiple of k as 3 and 10 are coprime. This, combined with Lemma 4, implies that
the smallest number in T that is a multiple of k is R(k), which is of length k. Thus, for
k ∈ {1, 2, 3r }, the smallest number in T that is a multiple of k is of length k. For all
other cases, the multiple can be chosen to have a length strictly smaller than k.

Lemma 6. If k > 2 and k is not a power of 3, then u + 3r φ(m) < k.

Proof. If k > 2 and k is not a power of 3, then either m > 5 or u ≥ 1. If m > 5,


then g(m) ≤ φ(m) < m and the result follows from Lemma 5. If u > 1, the proof of
Lemma 5 shows that u + 3r φ(m) ≤ u + 3r m < k. Suppose that u = 1 and m = 1, i.e.,
k ∈ {2 · 3r , 5 · 3r , 10 · 3r } and u + 3r φ(m) = 1 + 3r . Since k > 2, if k = 2 · 3r , then
r ≥ 1 and 1 + 3r < 2 · 3r . If k ≥ 5 · 3r , then clearly k > 1 + 3r .

Combining all of this, we have proven the following result.

Theorem 4. For any positive integer k > 2 that is not a power of 3, there exists a
number n of at most k − 1 digits that consists of the digits 0 and 1 and is a multiple
of k.

For example, this occurs for the case when k > 5 is prime, where p = q = r =
0, m = k, and g(k) divides φ(k) = k − 1. Thus for primes k > 5, both R(g(k))
and R(k − 1) are multiples of k. In fact, primes for which there does not exist a
shorter repunit multiple than R(k − 1) (i.e., g(k) = φ(k) = k − 1) are the full rep-
tend primes or long primes (https://oeis.org/A001913, http://mathworld.
wolfram.com/FullReptendPrime.html), as it is well known that for primes k > 5,
the period of the decimal expansion of 1/k is the same as the length of the smallest
repunit that is a multiple of k.

3. OTHER NUMBER BASES. So far we assume that the integers are expressed as
decimal numbers. Theorems 1 and 2 are also valid in other number bases.

Definition 3. An integer of the form 111 · · · 111 when written in b-ary notation is
called a b-repunit. A b-repunit of i b-ary digits is denoted as

i−1
X bi − 1
Rb (i) = bs = .
s=0
b−1

An integer that, when written as a b-ary number, consists of only the digits 0 and 1 is
called a binary b-ary number.

When b = 8, 10, 16, the word “b-ary” is replaced by octal, decimal, and hexadec-
imal, respectively. The proofs of the following two results are the same as the proofs
for Theorems 1 and 2.

Theorem 5. For any integer b ≥ 2 and positive integer k, there exists a positive binary
b-ary number n of at most k digits that is a multiple of k.

532 c THE MATHEMATICAL ASSOCIATION OF AMERICA [Monthly 121


This content downloaded from 173.81.62.55 on Fri, 30 May 2014 15:08:30 PM


All use subject to JSTOR Terms and Conditions
Theorem 6. For any integers k ≥ 1, b ≥ 2, and t ≥ 0, there exists a binary b-ary
number n such that n is a multiple of k and the 1’s in n are at least t digits apart.

Some of the results in Section 2 rely on the fact that 10 ≡ 1 mod 3, and these can
be extended to other bases as well. For instance, the well-known divisibility test for
dividing decimal numbers by 3 or 9 has an analog in other bases.

Lemma 7. Let a < b be such that b ≡ 1 mod a. Then a b-ary number is divisible by
a if and only if the sum of the digits is divisible by a.

Proof. By induction, it is easy to see that bk ≡ 1 mod a for all k. Consider a b-ary
number n with the sum of digits equal to m. Then n can be written as
m
X
b ki .
i=1

This implies that n ≡ m mod a, and thus n is divisible by a if and only if m is divisible
by a.

With the help of Lemma 7, Lemma 1 can be generalized as follows.

Lemma 8. Let a < b be such that b ≡ 1 mod a. For nonnegative integers r and m
there exists a b-ary number that is multiple of a r and consists only of the digits 0 and
1, such that the number of 1’s is a r with each pair of 1’s separated by m zeros.

IBM T. J. Watson Research Center, P. O. Box 218, Yorktown Heights, NY 10598


chaiwahwu@member.ams.org

June–July 2014] NOTES 533

This content downloaded from 173.81.62.55 on Fri, 30 May 2014 15:08:30 PM


All use subject to JSTOR Terms and Conditions

You might also like