8,9}

The key to a cipher called "turning grille" is a stencil made from a square sheet of grid paper of size $n \times n$

($n$ is even). Some of the cells are cut out. One of the sides of the stencil is marked. When this stencil is placed on a clean sheet of paper in four possible ways (with the marked side up, to the right, down, and to the left), its cutouts completely cover the entire area of the square, with each cell being under a cutout exactly once. The letters of the message, which has a length of $n^{2}$, are sequentially written into the cutouts of the stencil, first placed on a clean sheet of paper with the marked side up. After filling all the cutouts of the stencil with the letters of the message, the stencil is placed in the next position, and so on. After removing the stencil, the encrypted message appears on the sheet of paper.

Find the number of different keys for any even number $n$.

#
All cells of a square of size $n \times n$ will be divided into non-overlapping groups of four cells, which coincide with rotations around the center of the square. In the key-stencil, exactly one cell must be cut out from each group.

## Solution

All cells of the square of size will be divided into non-overlapping groups of four cells each. We will assign cells to the same group if, with each rotation of the square until it overlaps with itself, they move to the positions of cells in the same group. There will be a total of $\eta^{2} / 4$ such groups. When the stencil is placed on the square, exactly one cell from each group will be under its cutouts. To each stencil, we will correspond an ordered set of all cells from such groups that are under the cutouts of the stencil when it is placed on the square with the marked side up. There are $n^{2} / 4$ such cells (one from each group), so there are a total of $4^{n^{2} / 4}$ such sets.

## Answer

$4^{n^{2} / 4}$.

Submit a comment