652 Given positive integers $a, b, n, k$, satisfying $2 \leqslant a < b \leqslant n, k \geqslant 2$. In each cell of an $n \times n$ grid, a certain integer is filled. It is known that the sum of all numbers in any $a \times a$ subgrid is a multiple of $k$, and the sum of all numbers in any $b \times b$ subgrid is also a multiple of $k$. Find all $n$ such that the sum of all numbers in this grid is a multiple of $k$.
Solution: First, when $a \mid n$ (or $b \mid n)$, i.e., $n=k a$ (or $n=k b$), the $n \times n$ grid can be divided into $k^{2}$ $a \times a$ (or $b \times b$) units. Since the sum of all numbers in any of these units is a multiple of $k$, the sum of all numbers in the $n \times n$ grid is also a multiple of $k$.

Below is the construction: If $n$ is neither a multiple of $a$ nor a multiple of $b$, the sum of all numbers in the grid may not be a multiple of $k$.
Construct sequences $\left\{a_{n}\right\}$ and $\left\{b_{n}\right\}$:
$$
a_{a t+1}=1, a_{a(t+1)}=k-1(t \in \mathbf{N}),
$$

the rest are 0.
$$
b_{b t+1}=1, b_{b(t+1)}=k-1(t \in \mathbf{N}),
$$

the rest are 0;
It can be seen that $\left\{a_{n}\right\}$ and $\left\{b_{n}\right\}$ are periodic sequences with periods $a$ and $b$, respectively.
Let the sums of the first $n$ terms of $\left\{a_{n}\right\}$ and $\left\{b_{n}\right\}$ be $S_{n}$ and $T_{n}$, respectively.
By definition,
$k\left|S_{n} \Leftrightarrow a\right| n, S_{n} \equiv 1(\bmod k) \Leftrightarrow a \nmid n$,
$k\left|T_{n} \Leftrightarrow b\right| n, T_{n} \equiv 1(\bmod k) \Leftrightarrow b \nmid n$.
For the $n \times n$ grid, fill the cell $(i, j)$ with the number $a_{i} b_{j}$. The sum of numbers in any $a \times a$ and $b \times b$ unit is a multiple of $k$. The sum of all numbers is $S_{n} T_{n}$. When $n$ is neither a multiple of $a$ nor a multiple of $b$, $S_{n} T_{n} \equiv 1(\bmod k)$, which is not a multiple of $n$.
Therefore, the set of all $n$ is
$\left\{n \mid n=k a\right.$ or $\left.n=k b, k \in \mathbf{Z}_{+}\right)$.
(Chen Kai, Xueersi Peiyou Beijing Branch, 100080)