There are soldiers standing in a line, where is a positive integer. The soldiers can rearrange themselves into a new line only in the following way: the soldiers standing at odd numbered positions move to the front of the row, keeping their positions with respect to each other, and the soldiers previously standing at even numbered positions move to the end of the row, keeping their positions with respect to each other. Prove that after rearrangements the soldiers stand in the same ordering as in the beginning.
Solutions — 2
Solution 1
The last soldier does not change its position. The rest of the soldiers regroup just as in the case, when the last soldier was not there, and the number of the soldiers was . So, it suffices to prove the claim for soldiers. We show that after rearrangements the soldiers are in positions, which can be found in the original line by counting cyclically every -th soldier (after the last soldier we go to the first one). Indeed, after 0 rearrangements, the claim clearly holds, and every rearrangement makes us cyclically count every second soldier in the previous line (after the last soldier we go to the second one), the first soldier will still be counted first. After rearrangements the soldiers in the new line can be found by counting every -th soldier in the old line with soldiers. Since the remainder of when divided by is 1, this is equivalent to simply counting the soldiers. This means that we get back the original line.
Solution 2
Enumerate the soldiers starting from 0, and write the numbers in binary form (adding leading zeros to make the lengths of the binary codes equal; for example for we have the numbers 000, 001, 010, 011, 100, 101, 110, 111). After a rearrangement the soldiers stand in such a way that when reinterpreting the last digit as the first one (but leaving the order of the rest of the digits the same), the soldiers are again enumerated by consecutive numbers. After rearrangements the binary code of the soldiers has returned to the original, so every soldier's position corresponds to their original position in the line.