Maths Olympiad Prep

Track / Stage 4 / 76 of 340 #816 of 2444

Problem 816

AMC 12 late, AIME early
Combinatorics Difficulty 4.5 Find the answer February · United States · 2017

Yang has the sequence of integers 1,2,,20171,2, \ldots, 2017. He makes 2016 swaps in order, where a swap changes the positions of two integers in the sequence. His goal is to end with 2,3,,2017,12,3, \ldots, 2017,1. How many different sequences of swaps can Yang do to achieve his goal?

A number or a short expression. Fractions can be typed as 3/2, and spacing doesn't matter.

Next problem →

Official solution

Solution:

Let n=2017n=2017. The problem is asking to write a cycle permutation of nn integers as the product of n1n-1 transpositions. Say that the transpositions Yang uses are (ai,bi)(a_{i}, b_{i}) (i.e. swapping the aia_{i}-th integer in the sequence with the bib_{i}-th integer in the sequence). Draw the graph with edges (ai,bi)(a_{i}, b_{i}). One can show that the result is a cycle if and only if the resulting graph is acyclic, so it must be a tree. There are nn2n^{n-2} trees by Cayley's formula, and for each tree, it can be made in (n1)!(n-1)! ways (any ordering of the edges). So the total number of ways to end with a cycle is nn2(n1)!n^{n-2} \cdot (n-1)!. By symmetry, each cycle can be made in the same number of ways, so in particular the cycle 2,3,,n,12,3, \ldots, n, 1 can be made in nn2(n1)!(n1)!=nn2\frac{n^{n-2} \cdot (n-1)!}{(n-1)!} = n^{n-2} ways.

Source: MathNet, licensed CC-BY-4.0. Statement reproduced verbatim; metadata (topic, difficulty, ordering) added by this project.