Maths Olympiad Prep

Library / /3 of 6

, 2023

Combinatorics Difficulty 7.5 National Olympiad, round 2 Prove it Balkan Mathematical Olympiad

For an integer n2n \ge 2, the tuple (1,2,,n)(1, 2, \dots, n) is written on a blackboard. On each turn, one can choose two numbers from the tuple such that their sum is a perfect square and swap them to obtain a new tuple. Find all integers n2n \ge 2 for which all permutations of {1,2,,n}\{1, 2, \dots, n\} can appear on the blackboard in this way.

Solution

Answer: All integers n14n \ge 14.

We first note that we say the numbers aa and bb can be ultimately swapped if, after a number of moves, one can obtain the tuple in which only aa and bb are swapped. We now prove a result.

Claim. If integers a,b,c{1,2,,n}a, b, c \in \{1, 2, \dots, n\} are such that the numbers a,ba, b can be ultimately swapped and the numbers a,ca, c can be ultimately swapped, then b,cb, c can be ultimately swapped.

Proof. If we swap a,ba, b then a,ca, c and again a,ba, b it would be the same as swapping just b,cb, c.

abc \rightarrow bac \rightarrow bca \rightarrow acb.

Figure 1

Now, consider the graph where vertices correspond to the elements of the set {1,2,,n}\{1, 2, \dots, n\} and an edge is drawn between two distinct integers whenever their sum is a perfect square. We can swap any numbers when there is an edge between them and by the claim above, any two numbers can be ultimately swapped when there is a path between them. Hence, we can obtain all the possible permutations if and only if this graph is connected.

We observe that any positive integer x{1,2,4}x \notin \{1, 2, 4\} is connected to a positive integer smaller than xx. This can be easily seen if x8x \le 8. Suppose x9x \ge 9 and take nn such that n2x<(n+1)2n^2 \le x < (n+1)^2. Then xx is connected (n+1)2x(n+1)^2 - x and (n+1)2x2n+1<n2x(n+1)^2 - x \le 2n+1 < n^2 \le x holds as n3n \ge 3.

Hence, there are at most 3 connected components in this graph for any nn. For n=12n = 12, we have {1,3,6,8,10}\{1, 3, 6, 8, 10\}, {2,7,9}\{2, 7, 9\} and {4,5,11,12}\{4, 5, 11, 12\} as the connected components and the graph is still disconnected. 13 is connected to both 3 and 12, hence it reduces the number of components to 2; finally 14 is connected to 2 and 11 thus when n14n \ge 14, there is a unique connected component.

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.