[ Arithmetic of residues (miscellaneous). ]  [ Examples and counterexamples. Constructions ]

What is the maximum number of rooks that can be placed in an $8 \times 8 \times 8$ cube so that they do not attack each other?
Obviously, in each column of eight cube cells, only one rook can stand, so it is impossible to place more than 64 rooks.

Let's show how to place 64 rooks so that they do not attack each other. We introduce a coordinate system with axes along the edges of the cube, so that each cell has coordinates ( $x, y, z$ ) of numbers from 0 to 7, and place the rooks in cells where the sum of the coordinates is divisible by 8.

Suppose some two rooks attack each other. This means that two of their coordinates (say, $x$ and $y$ ) coincide, while the third ones are different (denote them as $z_{1}$ and $z_{2}$ ). The sums $x+y+z_{1}$ and $x+y+z_{2}$, and thus their difference $z_{1}-z_{2}$, are divisible by 8. But this is impossible, since $z_{1}$ and $z_{2}$ are different non-negative numbers less than 8.

Notice now that there is a rook in each vertical column, that is, that we have placed 64 rooks. Indeed, each such column is determined by its pair of coordinates $x$ and $y$. The coordinate $z$ for the rook in this column is uniquely determined by the condition $x+y+z \equiv 0(\bmod 8)$.

## Answer

64 rooks.