Maths Olympiad Prep

Library / South African Mathematical Olympiad Third Round /30 of 31

South African Mathematical Olympiad Third Round

Combinatorics Difficulty 7.7 National Olympiad, round 2 Prove it South Africa

Marjorie is the drum major of the world's largest marching band, with more than one million members. She would like the band members to stand in a square formation. To this end, she determines the smallest integer nn such that the band would fit in an n×nn \times n square and lets the members form rows of nn people. However, she is dissatisfied with the result, since some empty positions remain. Therefore, she tells the entire first row to go home and repeats the process with the remaining members. Her aim is to continue it until the band forms a perfect square, but as it happens, she does not succeed until the last members are sent home. Determine the smallest possible number of members in this marching band.

Solution

The answer is 10009771000977. Let MM be the number of members of the marching band. We prove by induction that Marjorie's approach always yields a perfect square at some point, unless MM is of the form M=(2a+b)2+2b+1M = (2^a + b)^2 + 2b + 1 (a,ba, b nonnegative integers, 0≤b<2a0 \le b < 2^a) or (2a+b)2+2a+3b+2(2^a + b)^2 + 2^a + 3b + 2 (a,ba, b nonnegative integers, 0≤b<2a−10 \le b < 2^a - 1), in which case all members are eventually sent home.

This is true for M=1M = 1 (which is not of either form), since the single member forms a 1×11 \times 1 square, and for M=2M = 2 (which is of the form M=(2a+b)2+2b+1M = (2^a + b)^2 + 2b + 1 with a=b=0a = b = 0), in which case the two members form an incomplete 2×22 \times 2 square and are sent home.

For the induction step, suppose that M>2M > 2 and take nn to be the unique positive integer for which (n−1)2<M≤n2(n-1)^2 < M \le n^2. Then the MM members will stand in an n×nn \times n square, and if M≠n2M \ne n^2, then nn members are sent home. We write n−1=2a+bn - 1 = 2^a + b, where 2a2^a is the greatest power of 2 less than or equal to n−1n-1, and 0≤b<2a0 \le b < 2^a. We claim that the process reaches a perfect square if and only if neither M=(2a+b)2+2b+1M = (2^a + b)^2 + 2b + 1 nor M=(2a+b)2+2a+3b+2M = (2^a + b)^2 + 2^a + 3b + 2 (the latter only for b<2a−1b < 2^a - 1).

Suppose first that M≤n2−n+1M \le n^2 - n + 1, so that M−n≤(n−1)2=(2a+b)2M - n \le (n-1)^2 = (2^a + b)^2. By the induction hypothesis, the process never reaches a perfect square if and only if M−n=(2a+b−1)2+2b−1M - n = (2^a + b - 1)^2 + 2b - 1 or M−n=(2a+b−1)2+2a+3b−1M - n = (2^a + b - 1)^2 + 2^a + 3b - 1. The former equation is equivalent to M=(2a+b−1)2+2a+3bM = (2^a + b - 1)^2 + 2^a + 3b. However, this is impossible since it gives

M=(2a+b−1)2+2a+3b=(2a+b)2−(2a−b−1)≤(n−1)2. M = (2^a + b - 1)^2 + 2^a + 3b = (2^a + b)^2 - (2^a - b - 1) \le (n - 1)^2.

The latter equation yields
M=(2a+b−1)2+2a+1+4b=(2a+b)2+2b+1, M = (2^a + b - 1)^2 + 2^{a+1} + 4b = (2^a + b)^2 + 2b + 1,
which is what we wanted to prove.

Likewise, if M>n2−n+1M > n^2 - n + 1, then M−n>(n−1)2M - n > (n-1)^2. So by the induction hypothesis, the process never reaches a perfect square if and only if either M−n=(2a+b)2+2b+1M - n = (2^a + b)^2 + 2b + 1 or M−n=(2a+b)2+2a+3b+2M - n = (2^a + b)^2 + 2^a + 3b + 2. In the former case, we get
M=(2a+b)2+2a+3b+2, M = (2^a + b)^2 + 2^a + 3b + 2,
which is exactly the desired statement. Note, however, that M≠n2M \neq n^2 (otherwise, the band forms a perfect square immediately) requires b<2a−1b < 2^a - 1. In the latter case, we obtain
M=(2a+b)2+2a+1+4b+3=(2a+b+1)2+2(b+1)>n2, M = (2^a + b)^2 + 2^{a+1} + 4b + 3 = (2^a + b + 1)^2 + 2(b + 1) > n^2,
which is impossible.

This completes the induction. Now note that 1000000=100021000000 = 1000^2 and 1000=29+4881000 = 2^9 + 488, so the smallest number greater than 10000001000000 that is of the form (2a+b)2+2b+1(2^a + b)^2 + 2b + 1 or (2a+b)2+2a+3b+2(2^a + b)^2 + 2^a + 3b + 2 is (29+488)2+2⋅488+1=1000977(2^9 + 488)^2 + 2 \cdot 488 + 1 = 1000977.

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.