Maths Olympiad Prep

Library / Dutch Mathematical Olympiad /31 of 31

Dutch Mathematical Olympiad

Number theory Difficulty 7.3 National Olympiad, round 2 Prove it Netherlands

An ℓ\ell-code is an integer n≥0n \ge 0 of at most ℓ\ell digits, if necessary supplemented by leading zeros, so that it consists of ℓ\ell digits in total. Thus, you can make a 4-code out of 310 by writing it as 0310. An ℓ\ell-code is called self-squared if the last ℓ\ell digits of the square of that code form exactly the original ℓ\ell-code. Thus, the 1-codes 5 and 6 are self-squared, but the 3-code 006 is not self-squared, because 62=36=0366^2 = 36 = 036 does not end in 006. The 2-code 76 is self-squared, because 762=577676^2 = 5776 ends in 76.

a. Prove that an ℓ\ell-code nn is self-squared if and only if n(n−1)n(n-1) is divisible by 10ℓ10^\ell.

b. Prove that any self-squared ℓ\ell-code n≥2n \ge 2 ends in the digit 5 or the digit 6.

c. Prove that any self-squared ℓ\ell-code n≥2n \ge 2 is extendable to a self-squared (ℓ+1)(\ell+1)-code in exactly one way by placing a digit in front of it.

d. It follows from (b) and (c) that for every ℓ\ell, there exist exactly two self-squared ℓ\ell-codes m,n≥2m, n \ge 2. What is their sum m+nm+n (in terms of ℓ\ell)?

Solution

a. Suppose that nn is a self-squared ℓ\ell-code. Then the last ℓ\ell digits of n2−n=n(n−1)n^2 - n = n(n - 1) are all zeros. This means that n(n−1)n(n - 1) is divisible by 10ℓ10^\ell. Vice versa, nn is self-squared if n2−nn^2 - n is divisible by 10ℓ10^\ell and thus ends in ℓ\ell zeros.

b. The number n(n−1)n(n - 1) is divisible by 10 and so, in particular, it is divisible by 5. This means that one of the numbers nn and n−1n - 1 must be divisible by 5. In other words, the last digit of either nn or n−1n - 1 must be a 0 or 5. So the only possible final digits for nn are 0, 1, 5 and 6.
If the last digit of nn is 0, then n−1n - 1 is not divisible by 2 or 5. Since n(n−1)n(n - 1) is divisible by 10ℓ=2ℓ⋅5ℓ10^\ell = 2^\ell \cdot 5^\ell and there can be no factors 2 or 5 in n−1n - 1, nn must be divisible by 10ℓ10^\ell. But that means that the last ℓ\ell digits of nn, which are all the digits of nn, must all be zeros. Then we get n=0n = 0, which is smaller than 2.
If the last digit of nn is a 1, then nn is not divisible by 2 or 5. Since n(n−1)n(n - 1) is divisible by 10ℓ=2ℓ⋅5ℓ10^\ell = 2^\ell \cdot 5^\ell and there can be no factors 2 or 5 in nn, n−1n - 1 must be divisible by 10ℓ10^\ell. But that means that the last ℓ\ell digits of n−1n - 1, which are all the digits of n−1n - 1, must all be zeros. Then we get n=1n = 1, which is smaller than 2.
So all self-quadratic codes n≥2n \ge 2 end in a 5 or 6.

c. Suppose that m=c⋅10ℓ+nm = c \cdot 10^\ell + n is an (ℓ+1)(\ell + 1)-code obtained by putting cc in front of nn. Because of (a), mm is self-squared if and only if
m(m−1)=(c⋅10ℓ+n)(c⋅10ℓ+n−1)=c2⋅102ℓ+c⋅10ℓ(2n−1)+n(n−1) m(m-1) = (c \cdot 10^{\ell} + n)(c \cdot 10^{\ell} + n-1) = c^2 \cdot 10^{2\ell} + c \cdot 10^{\ell}(2n-1) + n(n-1)
is divisible by 10ℓ+110^{\ell+1}. As ℓ≥1\ell \ge 1, the term c2⋅102ℓc^2 \cdot 10^{2\ell} is also divisible by 10ℓ+110^{\ell+1}. The number n(n−1)n(n-1) is divisible by 10ℓ10^\ell, because of part (a), and can therefore be written as d⋅10ℓd \cdot 10^\ell. It then follows that
c⋅10ℓ(2n−1)+d⋅10ℓ=10ℓ⋅(c(2n−1)+d) c \cdot 10^{\ell}(2n - 1) + d \cdot 10^{\ell} = 10^{\ell} \cdot (c(2n - 1) + d)
must be divisible by 10ℓ+110^{\ell+1}, or in other words that c(2n−1)+dc(2n - 1) + d must be divisible by 10.
Because of part (b), nn must end in a 5 or 6. If nn ends in a 5, then 2n−12n-1 is a multiple of ten minus one, i.e. it is of the shape 10k−110k-1, and we see that c(10k−1)+dc(10k-1)+d must be divisible by 10 and so −c+d-c+d must be divisible by 10. On the other hand, if nn ends in a 6, then 2n−12n-1 is a multiple of ten plus one, say 10k+110k+1, and we see that c(10k+1)+dc(10k+1)+d must be divisible by 10 and so c+dc+d must be divisible by 10.
In both cases, there is a unique possibility for cc from the numbers 0, 1, 2, ..., 9 for which −c+d-c+d (or c+dc+d) is divisible by 10, since, of the ten consecutive numbers −0+d,−1+d,...,−9+d-0+d, -1+d, ..., -9+d (or 0+d,1+d,...,9+d0+d, 1+d, ..., 9+d), exactly one is divisible by 10. Therefore, there is a unique digit cc that we can put before the ℓ\ell-code nn such that mm is a self-squared (ℓ+1)(\ell+1)-code.

d. Suppose that n≥2n \ge 2 is a self-squared ℓ\ell-code. Then we will show that k=10ℓ+1−nk = 10^\ell + 1 - n is also a self-squared ℓ\ell-code. Because n≥2n \ge 2, we have k≤10ℓ−1k \le 10^\ell - 1 and kk can thus really be written using ℓ\ell digits. From part (a) it follows that kk is self-squared if and only if
k(k−1)=(10ℓ+1−n)(10ℓ−n)=102ℓ+10ℓ(1−2n)+(n−1)n k(k-1) = (10^{\ell} + 1 - n)(10^{\ell} - n) = 10^{2\ell} + 10^{\ell}(1 - 2n) + (n-1)n
is divisible by 10ℓ10^\ell. The first two terms are always divisible by 10ℓ10^\ell and (n−1)n(n-1)n is divisible by 10ℓ10^\ell because nn is self-squared. So it follows that kk is self-squared.
Since n≤10ℓ−1n \le 10^\ell - 1, we have k≥2k \ge 2. Furthermore, 10ℓ+110^\ell + 1 is odd, and so one out of nn and kk is even and the other number is odd. In particular, nn and kk are thus not equal to each other. Since there are exactly two self-squared ℓ\ell-codes ≥2\ge 2, the other self-squared ℓ\ell-code mm must be equal to kk. It then holds that m+n=k+n=10ℓ+1m+n=k+n=10^\ell+1.

Want a route through all this instead of an archive? The track puts 2,604 problems in a working order, from Junior Challenge level to the IMO shortlist.

Source: MathNet, licensed CC-BY-4.0. Statement reproduced verbatim; metadata (topic, difficulty) added by this project.