Maths Olympiad Prep

Library / /14 of 23

Algebra Difficulty 6.3 National Olympiad Prove it Romania

A positive integer is called special if all of its digits are nonzero and any two adjacent digits are consecutive (not necessarily in ascending order).
a) Find the largest special number for which the sum of its digits is 20232023.
b) Find the smallest special number for which the sum of its digits is 20222022.

Solution

a) The largest number mm will have as many digits as possible, so we will choose the smallest possible digits. As next to a 11 we can only put a 22, and 2023=3674+12023 = 3 \cdot 674 + 1, we choose m=121211211349 digitsm = \underbrace{12121 \dots 121}_{1349 \text{ digits}}, with 674674 digits equal to 22 and 675675 digits equal to 11.

b) As 8+9=178+9=17 and 2022=17118+162022 = 17 \cdot 118+16, if in the decimal writing of nn we would use at most 237237 digits, the sum of these digits would be at most 118(8+9)+9<2022118 \cdot (8+9)+9 < 2022, false. Therefore we can't use fewer than 2118+2=2382 \cdot 118 + 2 = 238 digits. To use exactly 238238 digits, we must have 118118 groups of 88 and 99, and another two digits whose sum is 1616. The two digits could be 77 and 99, or 88 and 88. In both cases, the number of even digits of nn differs by 22 from the number of its odd digits. This is impossible, because in the decimal writing of a special number, the even digits alternate with the odd ones, so the number of its even digits is either equal to that of its odd digits, or differs from it by 11. Therefore nn must have at least 239239 digits. We are looking for three consecutive digits, smaller than 88, whose sum is at least 1616 and which are the first three digits of nn. Moreover, we are looking for the first digit of nn to be as small as possible. The smallest digits that fulfill these requirements are 55, 66, 77. The solution is n=56787898989117n = 56787\underbrace{8989\dots89}_{117}.

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.