A question of Mayo Olympiad on permutations and multiple of 7

contest-mathdivisibilityelementary-number-theory

I have tried to solve this problem without using a lot of calculations.

Problem. We consider all $7$-digit numbers that can be obtained by permuting in all possible ways the digits of $1234567$. How many of them are divisible by $7$?

I tried to use that $7$ divides $\overline{abcdefg}$ if and only if $7$ divides $a+\overline{efg}-\overline{bcd}$. I think the answer is $720$, but I was not able to solve it.

Any suggestions?

Best Answer

Let us consider the permutation $$\sigma ={\begin{pmatrix}1&2&3&4&5&6&7\\2&3&4&5&6&7&1\end{pmatrix}}$$ That is, $\sigma(i)=i+1$ for all $i$, $1\le i\le 6$ and $\sigma(7)=1$.

Note that $\sigma(i)\equiv_7i+1$ for all $i$.

Call a number that can be obtained by permuting the digits of $1234567$ a good number.

For a good number $n$ that is $d_6d_5d_4d_3d_2d_1d_0$ in decimal notation, let $\sigma(n)$ be $\sigma(d_6)\sigma(d_5)\sigma(d_4)\sigma(d_3)\sigma(d_2)\sigma(d_1)\sigma(d_0)$ in decimal notation. So $\sigma$ maps a good number to a good number.

Since $\sigma^7$ is the identity map, all good numbers are grouped into disjoints cosets, each of which is $\{n, \sigma(n), \sigma^2(n), \sigma^3(n), \sigma^4(n), \sigma^5(n), \sigma^6(n)\}$ for some good number $n$. (For example, $\{1354762, 2465173, 3576214, 4617325, 5721436, 6132547, 7243651\}$.)

$$\sigma(n)-n\equiv_71111111=7*11*13 * 1110 + 1\equiv_71$$ So, there is exactly one number in each coset that is divisible by 7.

Since there are $\frac{7!}7=720$ cosets, there are $720$ good numbers that are divisible by $7$.

Related Question