Maths Olympiad Prep

Library / MEMO Szeged /2 of 2

MEMO Szeged

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 n≥Nkn \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 3∤k3 \nmid k.

Solution

Solution:

If 3∣k3 \mid k, then for any n∈Nn \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 3∤k3 \nmid k, write k=2a5b⋅mk=2^{a} 5^{b} \cdot m with gcd⁡(m,10)=1\gcd(m, 10)=1. Let ℓ≥⌊log⁡10(m)⌋+2\ell \geq \left\lfloor \log_{10}(m) \right\rfloor + 2 be an integer divisible by ϕ(m)\phi(m), so 10ℓ≡1(modm)10^{\ell} \equiv 1 \pmod{m} by Euler-Fermat. By the size constraint of ℓ\ell, we can choose ai∈Na_{i} \in \mathbb{N} for 0≤i<m0 \leq i < m such that ai≡i(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 Nk≥max⁡(10max⁡(a,b),10ℓ)N_{k} \geq \max \left(10^{\max(a, b)}, 10^{\ell}\right). For n≥Nkn \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,…,am−1a_{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 1≤i<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,…,Gm−1G_{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,…,Gm−1G_{1}, \ldots, G_{m-1} as well). Then

Gi−G0=10d−ℓ(ai−a0)+10d−ℓ−1−ℓ⋅i(a0−ai)≡10d−1⋅(ai−a0)⋅(10−1)≡i⋅9⋅10d−1(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 −G0≡i⋅9⋅10d−1(modm)-G_{0} \equiv i \cdot 9 \cdot 10^{d-1} \pmod{m}, then m∣Gim \mid G_{i}. This choice of ii is possible, as mm is coprime to both 9 and 10, so the inverse of 9⋅10d−19 \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,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.