2

A permutation $a_1,\cdots, a_{2022}$ of $1,2,\cdots, 2022$ is called interesting if $|a_i - i|$ is a constant for all i. Find the number of interesting permutations.

Clearly the identity permutation is interesting. Replace $2022$ with $n$. I think that if $|a_i-i|\neq 0$, then it must equal $1$ (1). As an example, if $|a_i-i| = 4$, then $a_1 = 5, a_2 = 6,, a_3 = 7, a_4 = 8,$ and $a_5 = 9$ or $1$. But I'm not sure how to get a contradiction from this. Note that once we show (1), it is easy to show that there are no interesting nonidentity permutations if $n$ is odd since $n = \sum_{i=1}^n (a_i-i) = 0\mod 2$ for any interesting nonidentity permutation.

Edit: the original proof seems like it can be modified slightly to solve the general case.

First, we'll prove more formally that permutations get split into cycles of length $2k$. We indeed have that for $1\leq i\leq k, |a_i - i| = k$ implies that $a_i = i+k$ since $a_i = i-k$ is impossible ($a_i$ is positive). For $2k+1\leq i, |a_i - i| = k\Rightarrow a_i \ge k+1,$ and hence for $k+1\leq i\leq 2k,$ we must have $a_i = i-k.$ Then $\{1,\cdots, 2k\} = \{a_1,\cdots, a_{2k}\}.$ We claim that the statement P(x) holds where P(x) states that $\{x(2k) + 1,\cdots, (x+1)(2k)\} = \{a_{x(2k)+1},\cdots, a_{(x+1)(2k)}\}$ for all $x\ge 0$ (and we trim the indices if they're out of bounds or we can extend the permutation past n by ignoring extra elements). Assuming that $P(y)$ holds for all $y < x, x\ge 1$, we then have for $1\leq i\leq k, a_{(x+1)(2k)+i} = (x+1)(2k)+i + k$ since $(x+1)(2k)+i-k$ was already taken by some other elements by the inductive hypothesis. Also, for $k+1\leq i\leq 2k, a_{(x+1)(2k)+i} = (x+1)(2k)+i-k$ since none of these elements can be achieved by other $a_i$'s using similar reasoning to the base case. Hence by induction we have that $P(y)$ always holds provided y is in range and so for an interesting permutation we must have $2k | n$ (note that at any point in the construction, we also have $\{x(2k) + 1,\cdots, x(2k)+i\} \not\subseteq\{a_{x(2k)+1},\cdots, a_{x(2k)+i}\}$ for any $1\leq i < 2k$ so the permutation wouldn't be surjective if it were cut short because $2k\not\div n$. This would be shown more formally by adding this claim to the inductive hypothesis).

The above proof also shows that for an even divisor $2k$ of $n$, the permutation satisfying $|a_i-i| = k$ for all i is in fact unique (well technically we need to add this assumption to the inductive hypothesis but that's it); hence the result.

user33096
  • 2,081
  • 3
  • 12

1 Answers1

2

Interesting permutations have a very simple structure. Fix $|a_i-i|=k\ge1$, then there is only one option for $\pi(i)$ for $1\le i\le k$, which is $i+k$. Since a permutation is a bijection, we must also have $\pi(i+k)=i$ for $1\le i\le k$, for nothing would map to $i$ otherwise. This fixes a block of $2k$ inputs and outputs, and we can repeat the process on each block of $2k$ numbers. We exhaust all the numbers and thus form an interesting permutation iff $2k\mid n$.

Therefore the number of interesting permutations of $1,\dots,n$ equals $1$ (for the identity with $k=0$) plus the number of even divisors of $n$, which for $n=2022$ is $5$ since $2022=2×3×337$ with $4$ even divisors.

Parcly Taxel
  • 105,904