# Difference between revisions of "2011 AIME II Problems/Problem 14"

## Problem 14

There are N permutations $(a_{1}, a_{2}, ... , a_{30})$ of 1, 2, ... , 30 such that for $m \in \left\{{2, 3, 5}\right\}$, m divides $a_{n+m} - a_{n}$ for all integers n with $1 \leq n < n+m \leq 30$. Find the remainder when N is divided by 1000.

## Solution 1

Each position in the 30-position permutation is uniquely defined by an ordered triple $(i, j, k)$. The nth position is defined by this ordered triple where i is n mod 2, j is n mod 3, and k is n mod 5. There are 2 choices for i, 3 for j, and 5 for k, yielding 2*3*5=30 possible triples. Because the least common multiple of 2, 3, and 5 is 30, none of these triples are repeated and all are used. By the conditions of the problem, if i is the same in two different triples, then the two numbers in these positions must be equivalent mod 2. If j is the same, then the two numbers must be equivalent mod 3, and if k is the same, the two numbers must be equivalent mod 5.

The ordered triple (or position) in which the number one can be placed has 2 options for i, 3 for j, and 5 for k, resulting in 30 different positions it can be placed.

The ordered triple where 2 can be placed in somewhat constrained by the placement of the number 1. Because 1 is not equivalent to 2 mod 2, 3, or 5, the i, j, and k in their ordered triples must be different. Thus, for the number 2, there are (2-1) choices for i, (3-1) choices for j, and (5-1) choices for k. Thus, there are 1*2*4=8 possible placements for the number two once the number one is placed.

Because 3 is equivalent to 1 mod 2, it must have the same i as the ordered triple of 1. Because 3 is not equivalent to 1 or 2 mod 3 or 5, it must have different j and k values. Thus, there is 1 choice for i, (2-1) choices for j, and (4-1) choices for k, for a total of 1*1*3=3 choices for the placement of 3.

As above, 4 is even, so it must have the same value of i as 2. It is also 1 mod 3, so it must have the same j value of 2. 4 is not equivalent to 1, 2, or 3 mod 5, so it must have a different k value than that of 1, 2, and 3. Thus, there is 1 choice for i, 1 choice for j, and (3-1) choices for k, yielding a total of 1*1*2=2 possible placements for 4.

5 is odd and is equivalent to 2 mod 3, so it must have the same i value as 1 and the same j value of 2. 5 is not equivalent to 1, 2, 3, or 4 mod 5, so it must have a different k value from 1, 2, 3, and 4. However, 4 different values of k are held by these four numbers, so 5 must hold the one remaining value. Thus, only one possible triple is found for the placement of 5.

All numbers from 6 to 30 are also fixed in this manner. All values of i, j, and k have been used, so every one of these numbers will have a unique triple for placement, as above with the number five. Thus, after 1, 2, 3, and 4 have been placed, the rest of the permutation is fixed.

Thus, N = 30*8*3*2=30*24=1440. Thus, the remainder when N is divided by 1000 $\framebox[1.5\width]{440.}$

## Solution 2

We observe that the condition on the permutations means that two numbers with indices congruent $\mod m$ are themselves congruent $\mod m$ for $m \in \{ 2,3,5\}.$ Furthermore, suppose that $a_n \equiv k \mod m.$ Then, there are $30/m$ indices congruent to $n \mod m,$ and $30/m$ numbers congruent to $k \mod m,$ because 2, 3, and 5 are all factors of 30. Therefore, since every index congruent to $n$ must contain a number congruent to $k,$ and no number can appear twice in the permutation, only the indices congruent to $n$ contain numbers congruent to $k.$ In other words, $a_i \equiv a_j \mod m \iff i \equiv j \mod m.$

This tells us that in a valid permutation, the congruence classes $\mod m$ are simply swapped around, and if the set $S$ is a congruence class $\mod m$ for $m =$ 2, 3, or 5, the set $\{ a_i \vert i \in S \}$ is still a congruence class $\mod m.$ Clearly, each valid permutation of the numbers 1 through 30 corresponds to exactly one permutation of the congruence classes modulo 2, 3, and 5. Also, if we choose some permutations of the congruence classes modulo 2, 3, and 5, they correspond to exactly one valid permutation of the numbers 1 through 30. This can be shown as follows: First of all, the choice of permutations of the congruence classes gives us every number in the permutation modulo 2, 3, and 5, so by the Chinese Remainder Theorem, it gives us every number $\mod 2\cdot 3\cdot 5 = 30.$ Because the numbers must be between 1 and 30 inclusive, it thus uniquely determines what number goes in each index. Furthermore, two different indices cannot contain the same number. We will prove this by contradiction, calling the indices $a_i$ and $a_j$ for $i \neq j.$ If $a_i=a_j,$ then they must have the same residues modulo 2, 3, and 5, and so $i \equiv j$ modulo 2, 3, and 5. Again using the Chinese Remainder Theorem, we conclude that $i \equiv j \mod 30,$ so because $i$ and $j$ are both between 1 and 30 inclusive, $i = j,$ giving us a contradiction. Therefore, every choice of permutations of the congruence classes modulo 2, 3, and 5 corresponds to exactly one valid permutation of the numbers 1 through 30.

We have now established a bijection between valid permutations of the numbers 1 through 30 and permutations of the congruence classes modulo 2, 3, and 5, so $N$ is equal to the number of permutations of congruence classes. There are always $m$ congruence classes $\mod m,$ so $N = 2! \cdot 3! \cdot 5! = 2 \cdot 6 \cdot 120 = 1440 \equiv \framebox[1.3\width{440} \mod 1000.$ (Error compiling LaTeX. ! File ended while scanning use of \@framebox.)