Example 13 (2004-2005 Hungarian Mathematical Olympiad) Find the largest integer $k$ such that $k$ satisfies the following condition: for all integers $x, y$, if $x y+1$ is divisible by $k$ then $x+y$ is also divisible by $k$.
In
Lin
Yuan
Ke
Mathematics
the
number
theory
problem
solution only needs to consider $k=\prod_{i} p_{i}^{\alpha_{i}}\left(p_{i}\right.$ is prime, $\left.\alpha_{i} \geqslant 0\right)$.
Take $(x, k)=1$, then there exists $m \in \mathbf{Z}_{+}$, and $1 \leqslant m \leqslant k-1$, such that $m x^{2} \equiv-1(\bmod k)$.
Let $y=m x$, then $k \mid(x y+1)$.
By the condition, we have $k \mid(x+y)$, i.e., $k \mid(m+1) x$.
Therefore, $k \mid(m+1) x^{2}$.
Also, $k \mid\left(m x^{2}+1\right)$, so $k \mid\left(x^{2}-1\right)$.
Thus, $x^{2} \equiv 1\left(\bmod p_{i}\right)$, for any $p_{i} 、 x\left(p_{i} \times x\right)$.
Hence, $p_{i}=2$ or $3, k=2^{\alpha} \times 3^{\beta}$.
For any $x, 2 \times x$, we have $x^{2} \equiv 1\left(\bmod 2^{a}\right)$.
Therefore, $\alpha \leqslant 3$ (note that the square of any odd number modulo 8 is 1, but modulo 16 does not have this property).
Similarly, $\beta \leqslant 1$.
Thus, $k \leqslant 8 \times 3=24$.
Below is the proof: 24 satisfies the requirement.
If there exist $x 、 y \in \mathbf{Z}_{+}$, such that $24 \mid(x y+1)$, then
$$
\begin{array}{l}
(x, 24)=1,(y, 24)=1 . \\
x, y \equiv 1,5,7,11,13,17,19,23(\bmod 24) .
\end{array}
$$

Since for a fixed $a, a x \equiv-1(\bmod 24)$ has a unique solution modulo 24, and $x y \equiv-1(\bmod 24)$, we have
$$
\begin{array}{l}
x \equiv 1(\bmod 24), y \equiv 23(\bmod 24) ; \\
x \equiv 5(\bmod 24), y \equiv 19(\bmod 24) ; \\
x \equiv 7(\bmod 24), y \equiv 17(\bmod 24) ; \\
x \equiv 11(\bmod 24), y \equiv 13(\bmod 24) .
\end{array}
$$

In any case, we have $24 \mid(x+y)$.
Therefore, $k=24$ is the solution.