Maths Olympiad Prep

Library / /1318 of 1394

, 2023

Combinatorics Difficulty 6.1 National Olympiad Prove it United States

Problem:

Svitlana writes the number 147147 on a blackboard. Then, at any point, if the number on the blackboard is nn, she can perform one of the following three operations:

- if nn is even, she can replace nn with n2\frac{n}{2};
- if nn is odd, she can replace nn with n+2552\frac{n+255}{2}; and
- if n64n \geq 64, she can replace nn with n64n-64.

Compute the number of possible values that Svitlana can obtain by doing zero or more operations.

Solution

Solution:

The answer is 163=i=04(8i)163=\sum_{i=0}^{4}\binom{8}{i}. This is because we can obtain any integer less than 282^{8} with less than or equal to 44 ones in its binary representation. Note that 147=27+24+21+20147=2^{7}+2^{4}+2^{1}+2^{0}.

We work in binary. Firstly, no operation can increase the number of ones in nn's binary representation. The first two operations cycle the digits of nn to the right, and the last operation can change a 11,10,0111,10,01 at the front of nn to 10,01,0010,01,00, respectively. This provides an upper bound.

To show we can obtain any of these integers, we'll show that given a number m1m_{1} with base 22 sum of digits kk, we can obtain every number with base 22 sum of digits kk. Since we can, by cycling, change any 1010 to an 0101, we can move all of m1m_{1}'s ones to the end, and then cycle so they're all at the front. From here, we can just perform a series of swaps to obtain any other integer with this same sum of digits. It's also easy to see that we can decrement the sum of digits of nn, by cycling a 11 to the second digit of the number and then performing the third operation. So this proves the claim.

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.