Choose the right modulus! Modular arithmetic is a powerful tool for analyzing all kinds of number-theoretic Math-Olympiad problems. Modular arithmetic often yields very short and efficient proofs. Consider for instance the equation x2 + y 2 + z 2 = 8.000.000.007. Does this equation possess integral solutions? Working modulo 8 demonstrates that the answer is negative: If a ≡ 0, 1, 2, 3, 4, 5, 6, 7 (mod 8), then a2 ≡ 0, 1, 4, 1, 0, 1, 4, 1 (mod 8). In other words, a square takes only the values 0, 1, 4 modulo 8. Hence, the sum of three squares can only take the values 0, 1, 2, 3, 4, 5, 6 modulo 8 (Verify this! Check that the value 7 indeed does not occur on the list!). And that’s already the desired contradiction, since the right hand side of the equation equals ≡ 7 (mod 8). Done. Note that working modulo 4 would not yield any contradiction here: A square can only take the values 0 and 1 modulo 4. Hence the sum of three squares can only take the values 0, 1, 2, 3 modulo 4. The right hand side is ≡ 3 (mod 4). No contradiction. Check for yourself that also working modulo 2, 3, 5, 6, 7, 9, and 10 would not yield contradictions! m Squares mod m Cubes mod m 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 1 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4 3, 2, 4 4, 4, 3, 4, 3, 2, 4, 4, 2, 4, 4, 4, 4 4 7 5, 4, 9 4, 4, 6, 9 4, 7, 5, 5, 6, 9 5, 9 9, 10, 12 7, 8, 9, 11 9, 10 8, 9, 6, 9, 9, 13, 15, 16 10, 13, 16 7, 9, 11, 16, 17 16 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 3 2, 2, 6 3, 8 2, 2, 3, 5, 6, 2, 3, 2, 8, 7, 3, 3, 4 3, 4, 5 5, 7 3, 3, 4, 8, 7, 3, 5, 3, 9, 8, 4, 4, 5, 6, 7, 8, 9 4, 5, 6, 7, 8, 9, 10 5, 7, 8, 9, 11 12 8, 13 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 7, 8, 9, 11, 13, 15 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 10, 17 11, 12, 18 5, 7, 8, 9, 11, 12, 13, 15, 16, 17, 19 Table 1: Possible residual classes for squares and cubes modulo m. Apparently, finding the right modulus m in this type of problem amounts to finding a needle in a haystack. . . As a rule of thumb, you should choose your modulus in such a way that the terms in the equation cover only a small range of residual classes. Since Math-Olympiad problems rarely require a modulus m ≥ 20, you should acquaint yourself with the behavior of squares and cubes under small moduli; see Table 1. We can extend the table to fourth, fifth, and sixth powers (see Table 2). Why does the table for fifth powers contain so much more data than the tables for fourth and sixth powers? 1 Here is another example that can routinely be solved by modular arithmetic: “Prove that there is no integer n ≥ 1, for which 2n − 1, 5n − 1, and 13n − 1 all are squares.” We work modulo 16. n 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2n − 1 5n − 1 13n − 1 15 15 15 1 4 12 3 9 9 5 14 6 7 3 3 9 8 0 11 13 13 13 2 10 15 7 7 1 12 4 3 1 1 5 6 14 7 11 11 9 0 8 11 5 5 13 10 2 The only squares modulo 16 are 0, 1, 4, 9. Every column of the table contains at least one non-square value 2n − 1 or 5n − 1 or 13n − 1 modulo 16. Done. (Note: This actually is a problem that was posed at IMO 1986.) Alternative solution: Suppose 2n − 1 = x2 , 5n − 1 = y 2 , 13n − 1 = z 2 . From x2 = 2n − 1 we 2 deduce that x is odd, whence x2 ≡ 1 (mod 4). So n = x 2+1 is odd as well. Hence y and z are even, 2 2 = 13n−5n = 2n. As n say y = 2y1 and z = 2z1 . Apparently (z1 − y1 )(z1 + y1 ) = z12 − y12 = z −y 4 4 is odd, exactly one of the two factors (z1 − y1 ) or (z1 + y1 ) must contain the factor 2. However, by z1 −y1 = z1 +(−1)·y1 ≡ z1 +1·y1 (mod 2) we know those factors have the same parity; contradiction. The following problems can all be settled by working with the right modulus m. There is no need to look at moduli m > 20. Problem 1. Show that the following equations do not possess integral solutions: (a) x2 + 3 = 15y. (b) x2 + y 5 = 11.000.000.007. (c) x5 − y 2 = 4. Problem 2. Prove that 20022002 cannot be written as the sum of three cubes. Problem 3. Find all solutions of 1! + 2! + · · · + n! = m2 with integers m, n ≥ 2. Problem 4. Prove that there do not exist 25 consecutive integers n + 1, . . . , n + 25 that can all be written as the sum of a cube and a fourth power. Problem 5. Find all integer solutions of m4 + m2 = n4 + 5. Problem 6. Find all positive integer solutions of 3x + 7y = 5z + 1. Problem 7. Find all integer solutions of m2 + 3mn − 2n2 = 122. Problem 8. Find all triples (a, b, c) of positive integers such that (a) 3a + 4b and 4a + 3b and a + b + 3 all are perfect squares. (b) a! = 2b + 2c . (c) a2 + ab − 3b2 = 35. 2 m Squares mod m Cubes mod m 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 1 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4 3, 2, 4 4, 4, 3, 4, 3, 2, 4, 4, 2, 4, 4, 4, 4 4 7 5, 4, 9 4, 4, 6, 9 4, 7, 5, 5, 6, 9 5, 9 9, 10, 12 7, 8, 9, 11 9, 10 8, 9, 6, 9, 9, 13, 15, 16 10, 13, 16 7, 9, 11, 16, 17 16 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 3 2, 2, 6 3, 8 2, 2, 3, 5, 6, 2, 3, 2, 8, 7, 3, 3, 4 3, 4, 5 5, 7 3, 3, 4, 8, 7, 3, 5, 3, 9, 8, 4, 4, 5, 6, 7, 8, 9 4, 5, 6, 7, 8, 9, 10 5, 7, 8, 9, 11 12 8, 13 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 7, 8, 9, 11, 13, 15 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 10, 17 11, 12, 18 5, 7, 8, 9, 11, 12, 13, 15, 16, 17, 19 m Fourth powers mod m Fifth powers mod m Sixth powers mod m 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 1 1 1, 1, 1 1, 1, 1, 1, 1, 1, 1, 1 1, 1, 1, 1, 3, 4 2, 4 4, 5, 3, 4, 3, 2, 6, 7 6 4, 5, 9 9 9 4, 7, 8, 9, 11 10 4, 4, 4, 5, 13, 16 7, 9, 10, 13, 16 5, 6, 7, 9, 11, 16, 17 16 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 3 2, 3, 2, 3, 2, 3, 3, 5, 2, 4, 2, 3, 10 3, 4, 2, 3, 2, 3, 2, 3, 3, 5, 2, 3, 2, 4, 2, 3, 3, 4, 4 4, 4, 7 5, 4, 7, 8 5, 6, 7, 8, 9 5, 4, 4, 4, 7, 4, 5, 4, 5, 7, 5, 5, 5, 9, 5, 7, 5, 7, 5 5, 6 8, 9, 11 6, 7, 8, 9, 10, 11, 12 6, 7, 8, 9, 10, 11, 12, 13 6, 7, 8, 9, 10, 11, 12, 13, 14 11, 13, 15 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 8, 9, 10, 11, 13, 14, 16, 17 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 8, 9, 11, 12, 13, 15, 16, 17, 19 1 1 1, 1, 1 1 1 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4 3, 4 4, 5, 6, 3, 4, 5, 4, 9 12 7, 8 4, 6, 9, 9 2, 4, 8, 9, 10 7, 11 4, 5, 9, 9 9 10 9, 13, 15, 16 16 Table 2: Possible residual classes for squares, cubes, and fourth, fifth, and sixth powers modulo m. 3