Maths Olympiad Prep

Library / /28 of 36

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

Problem:

For a positive integer nn, denote by s(n)s(n) the sum of the digits of nn (in its usual decimal representation). For example, s(8)=8,s(2023)=7,s(573)=15s(8)=8, s(2023)=7, s(573)=15.

a) Determine whether there exist distinct positive integers aa and bb such that
2023a+s(a)=2023b+s(b). 2023 \cdot a + s(a) = 2023 \cdot b + s(b).

b) Determine whether there exist distinct positive integers aa and bb such that
a+2023s(a)=b+2023s(b). a + 2023 \cdot s(a) = b + 2023 \cdot s(b).

Solution

Solution:

a.
They exist: it suffices to take, for example, a=1020241a = 10^{2024} - 1 and b=102024+8b = 10^{2024} + 8.
To prove this, observe that the base-10 representation of aa consists of 2024 consecutive digits equal to 9, so that s(a)=92024s(a) = 9 \cdot 2024, while bb is written as a digit 1 followed by 2023 digits 0 and a digit 8, so that s(b)=9s(b) = 9. At this point
2023(ba)=20239=202499=s(a)s(b), 2023 \cdot (b - a) = 2023 \cdot 9 = 2024 \cdot 9 - 9 = s(a) - s(b),
which is equivalent to the claim.

b.
They exist: it suffices to take, for example, a=793a = 793 and b=19000b = 19000 (among the solutions with a<ba < b this is also the one with the smallest possible bb). Indeed
ba=18207=20239=2023(1910)=2023(s(a)s(b)), b - a = 18207 = 2023 \cdot 9 = 2023 \cdot (19 - 10) = 2023 \cdot (s(a) - s(b)),
which is equivalent to the claim.

Heuristic for part (a)
One possible strategy for finding an example is the following. Observe that, if we write b=a+kb = a + k, then
2023b+s(b)=2023a+2023k+s(a+k), 2023 \cdot b + s(b) = 2023 \cdot a + 2023 \cdot k + s(a + k),
and the original equation becomes
s(a)=2023k+s(a+k), s(a) = 2023 \cdot k + s(a + k),
which clearly shows that s(a+k)s(a + k) must be much smaller than s(a)s(a).
It is then natural to choose as aa a number made up entirely of digits 9 and kk small (for instance, a single digit), so that b=a+kb = a + k is a number starting with the digit 1, followed by many zero digits, and hence s(b)s(b) is much smaller than s(a)s(a).
At this point it only remains to correctly choose kk and the number of digits 9 in aa: if aa consists of cc digits equal to 9, then s(a)=9cs(a) = 9c. Taking kk to be a single-digit number, b=a+kb = a + k is written as a digit 1, followed by many zeros and finally by the digit k1k - 1, so that s(b)=s(a+k)=ks(b) = s(a + k) = k. Substituting these choices into the initial equation we obtain
2023a+s(a)=2023a+9cand2023b+s(b)=2023a+2023k+k 2023a + s(a) = 2023a + 9c \quad \text{and} \quad 2023b + s(b) = 2023a + 2023k + k
that is, we get the equation 9c=2024k9c = 2024k. Since we are looking for kk made up of a single digit, it is natural to take k=9k = 9 and c=2024c = 2024, which gives the solution described above.

Heuristic for part (b)
One possible strategy for finding an example is the following. Writing the equation in the form
ba=2023(s(a)s(b)) b - a = 2023 \cdot (s(a) - s(b))
we observe that the difference bab - a is a multiple of 2023. On the other hand, it is well known that the sum of the digits of aa leaves the same remainder as aa upon division by 9: writing then s(a)=a9x,s(b)=b9ys(a) = a - 9x, s(b) = b - 9y we obtain ba=2023(a9xb+9y)b - a = 2023(a - 9x - b + 9y), that is
2024(ba)=92023(yx). 2024(b - a) = 9 \cdot 2023 \cdot (y - x).
Since 9 and 2024 have no common prime factors, this equation shows that bab - a is also divisible by 9. Moreover, 2023 also has no factors in common with 9, so bab - a (being a multiple of 2023 and of 9) is a multiple of 92023=182079 \cdot 2023 = 18207.
At this point we write b=a+18207kb = a + 18207k and substitute into the initial equation: we find that
a+2023s(a)=a+18207k+2023s(a+18207k) a + 2023 \cdot s(a) = a + 18207k + 2023 \cdot s(a + 18207k)
from which
s(a)=9k+s(a+18207k). s(a) = 9k + s(a + 18207k).
Trying to choose k=1k = 1, we would like to find two numbers aa and b=a+18207b = a + 18207 such that the sum of the digits of bb is 9 less than the sum of the digits of aa. At this point it is not hard to conclude: in order for s(a+18207)s(a + 18207) to be smaller than s(a)s(a) we would like there to be some carrying, and one of the simplest choices to try is precisely a=793a = 793, so that a+18207=19000a + 18207 = 19000 has many digits 0. One immediately checks that this choice works.

General solutions
It is possible to find general solutions to the equations of the problem, in which 2023 is replaced by any positive integer NN. The first equation in general form, Na+s(a)=Nb+s(b)N \cdot a + s(a) = N \cdot b + s(b), admits as a solution a=10N+11,b=a+9a = 10^{N+1} - 1, b = a + 9: indeed N(ba)=9N=9(N+1)9=s(a)s(b)N \cdot (b - a) = 9N = 9(N + 1) - 9 = s(a) - s(b).
To study the second equation in general form, a+Ns(a)=b+Ns(b)a + N \cdot s(a) = b + N \cdot s(b), observe that the identity s(x+y)=s(x)+s(y)9r(x,y)s(x + y) = s(x) + s(y) - 9r(x, y) holds, where r(x,y)r(x, y) is the number of carries obtained in adding x,yx, y in columns. We then define B=1+s(9N)9B = 1 + \frac{s(9N)}{9} and call CC the number of digits of 9N9N minus one; we then set a=10C(10B1)a = 10^{C}(10^{B} - 1) and b=a+9Nb = a + 9N.
The number aa then consists of BB digits 9 followed by CC digits 0 (in particular, s(a)=9B=9+s(9N)s(a) = 9B = 9 + s(9N)). Adding aa and 9N9N in columns, by construction BB carries occur (each digit 9 causes one and only one carry), so r(a,9N)=Br(a, 9N) = B and s(b)=s(a+9N)=s(a)+s(9N)9r(a,9N)=9B+s(9N)9B=s(9N)s(b) = s(a + 9N) = s(a) + s(9N) - 9r(a, 9N) = 9B + s(9N) - 9B = s(9N). Substituting into the initial equation we then have
ba=9N=N(9+s(9N)s(9N))=N(s(a)s(b)). b - a = 9N = N(9 + s(9N) - s(9N)) = N(s(a) - s(b)).

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

Source: MathNet, licensed CC-BY-4.0. Statement translated into English from it; metadata (topic, difficulty) added by this project.