Task B-1.6. How many ordered pairs of integers $x, y, 0<x<y<10^{6}$ are there such that their arithmetic mean is exactly 8 greater than their geometric mean? (The geometric mean of numbers $a$ and $b$ is the number $\sqrt{a \cdot b}$.)
## Solution.

$$
\begin{aligned}
& \frac{x+y}{2}=8+\sqrt{x y} \\
& x+y=16+2 \sqrt{x y} \\
& (\sqrt{x})^{2}-2 \sqrt{x y}+(\sqrt{y})^{2}=16 \\
& (\sqrt{x}-\sqrt{y})^{2}=16
\end{aligned}
$$

Given that $0<x<y<10^{6}$, it follows that $0<\sqrt{x}<\sqrt{y}<1000$ and

$$
\sqrt{y}-\sqrt{x}=4 \Rightarrow \sqrt{y}=\sqrt{x}+4
$$

The problem reduces to determining the number of ordered pairs

$$
(n, n+4), n \in \mathbb{N} \text { such that } n+4<1000
$$

| $\mathrm{n}$ | $\mathrm{n}+4$ |
| :---: | :---: |
| 1 | 5 |
| 2 | 6 |
| $\cdot$ | $\cdot$ |
| $\cdot$ | $\cdot$ |
| . | $\cdot$ |
| 994 | 998 |
| 995 | 999 |

From the table, it can be seen that there are exactly 995 such ordered pairs, and thus there are 995 pairs of numbers $(x, y)$ since

$$
x=n^{2}, y=(n+4)^{2} \text { and } 0<n^{2}<(n+4)^{2}<10^{6}
$$