Maths Olympiad Prep

Library / /2 of 3

Number theory Difficulty 7.5 National Olympiad, round 2 Prove it Middle European Mathematical Olympiad (MEMO)

Problem:

Define glueing of positive integers as writing their base ten representations one after another and interpreting the result as the base ten representation of a single positive integer.
Find all positive integers kk for which there exists an integer NkN_{k} with the following property: for all nNkn \geq N_{k}, we can glue the numbers 1,2,,n1,2, \ldots, n in some order so that the result is a number divisible by kk.

Remark. The base ten representation of a positive integer never starts with zero.

Example. Glueing 15, 14, 7 in this order makes 15147.

Answer. kk has this property if and only if 3k3 \nmid k.

Solution

Solution:

If 3k3 \mid k, then for any nNn \in \mathbb{N} of the form n=3k+1n=3k+1, the sum of the digits of all positive integers up to nn gives remainder 1 modulo 3. As a positive integer is divisible by 3 if and only if the sum of its digits is divisible by 3, no matter how we glue 1,2,,n1,2, \ldots, n, the resulting number is not divisible by 3, hence also not by kk. So no appropriate NkN_{k} can be chosen.

If 3k3 \nmid k, write k=2a5bmk=2^{a} 5^{b} \cdot m with gcd(m,10)=1\gcd(m, 10)=1. Let log10(m)+2\ell \geq \left\lfloor \log_{10}(m) \right\rfloor + 2 be an integer divisible by ϕ(m)\phi(m), so 101(modm)10^{\ell} \equiv 1 \pmod{m} by Euler-Fermat. By the size constraint of \ell, we can choose aiNa_{i} \in \mathbb{N} for 0i<m0 \leq i < m such that aii(modm)a_{i} \equiv i \pmod{m} and aia_{i} has \ell digits. Note that all aia_{i} are different and can also be chosen to be different from 10max(a,b)10^{\max(a, b)}. Take Nkmax(10max(a,b),10)N_{k} \geq \max \left(10^{\max(a, b)}, 10^{\ell}\right). For nNkn \geq N_{k} we glue 1,2,,n1,2, \ldots, n the following way:

(a) We put 10max(a,b)10^{\max(a, b)} at the end of the glueing, so the glued number ends with max(a,b)\max(a, b) zeros, ensuring that the number is divisible by 2a5b2^{a} 5^{b}.

(b) At the beginning of the number we put a0a_{0}, then the number 1, then a1,a2,,am1a_{1}, a_{2}, \ldots, a_{m-1} in this order.

(c) We put the remaining numbers in the middle, in an arbitrary order.

Let G0G_{0} be the number given by this glueing, and for 1i<m1 \leq i < m let GiG_{i} be the number we get from the same glueing, except for swapping a0a_{0} and aia_{i}. We show that at least one of the integers G0,G1,,Gm1G_{0}, G_{1}, \ldots, G_{m-1} is divisible by mm, and as all of them are divisible by 2a5b2^{a} 5^{b}, one of them will be divisible by kk, finishing the proof.

Let dd be the number of digits of G0G_{0} (and hence of G1,,Gm1G_{1}, \ldots, G_{m-1} as well). Then

GiG0=10d(aia0)+10d1i(a0ai)10d1(aia0)(101)i910d1(modm). G_{i} - G_{0} = 10^{d-\ell}(a_{i} - a_{0}) + 10^{d-\ell-1-\ell \cdot i}(a_{0} - a_{i}) \equiv 10^{d-1} \cdot (a_{i} - a_{0}) \cdot (10-1) \equiv i \cdot 9 \cdot 10^{d-1} \pmod{m}.

So if ii is such that G0i910d1(modm)-G_{0} \equiv i \cdot 9 \cdot 10^{d-1} \pmod{m}, then mGim \mid G_{i}. This choice of ii is possible, as mm is coprime to both 9 and 10, so the inverse of 910d19 \cdot 10^{d-1} exists modulo mm. Therefore GiG_{i} is a gluing of 1,2,,n1,2, \ldots, n, divisible by kk.

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 reproduced verbatim; metadata (topic, difficulty) added by this project.