
3. Find for which positive integers $a, b$ is the value of the fraction

$$
\frac{b^{2}+a b+a+b-1}{a^{2}+a b+1}
$$

equal to an integer.


Solution. We show that the only possible pairs $(a, b)$ are those of the form $(1, b)$, where $b$ is an arbitrary positive integer.

Denote $X=a^{2}+a b+1=a(a+b)+1$ and $Y=b^{2}+a b+a+b-1=(b+1)(a+b)-1$. If $X$ is a divisor of $Y$, then it is also a divisor of

$$
(b+1) X-a Y=(b+1)[a(a+b)+1]-a[(b+1)(a+b)-1]=a+b+1,
$$

which as a positive multiple of $X$ thus satisfies the inequality

$$
a+b+1 \geqslant X=a^{2}+a b+1 \text {. }
$$

Subtracting the 1 and dividing by $a+b$ gives $1 \geqslant a$, so necessarily $a=1$.

Conversely, if $a=1$, then $X=b+2$ and $Y=b^{2}+2 b=b(b+2)$, so, indeed, $X \mid Y$.
