Find all integers $a, b \geq 1$ such that the two quantities

$$
\frac{a^{2}+b}{b^{2}-a} \quad \text { and } \quad \frac{b^{2}+a}{a^{2}-b}
$$

are integers.
(Order of magnitudes, using the fact that if $b \geq 1$ and $a \mid b$, then $a \leq b$)

Let $a, b \geq 1$ satisfy the conditions of the statement, and, by symmetry, assume $b \geq a$. Then $a^{2}+b \geq b^{2}-a$ and $b^{2}+a \geq a^{2}-b$, which can also be written as

$$
(a-b+1)(a+b) \geq 0, \quad(b-a+1)(a+b) \geq 0
$$

We deduce that $a=b$ or $a=b-1$.

First case: $a=b$. Then $a^{2}-a \mid a^{2}+a$. Now $\frac{a^{2}+a}{a^{2}-a}=\frac{a+1}{a-1}=1+\frac{2}{a-1}$. We deduce the solutions $(a, b)=(2,2),(3,3)$.

Second case: $a=b-1$. In this case, $\frac{a^{2}+b}{b^{2}-a}=1$, and

$$
\frac{b^{2}+a}{a^{2}-b}=\frac{(a+1)^{2}+a}{a^{2}-a-1}=\frac{a^{2}+3 a+1}{a^{2}-a-1}=1+\frac{4 a+2}{a^{2}-a-1}
$$

Now

$$
4 a+2 \geq a^{2}-a-1 \quad \Longleftrightarrow \quad a^{2}-5 a-3 \leq 0
$$

Since $a^{2}-5 a-3$ is negative for $a=5$ and positive for $a=6$, we deduce that $a \leq 5$, and we check that conversely only $a=1,2$ work.

We finally find $(a, b)=(1,2),(2,1),(2,3),(3,2),(2,2),(3,3)$ as solutions.