XXXV OM - II - Problem 1

For a given natural number $ n $, find the number of solutions to the equation $ \sqrt{x} + \sqrt{y} = n $ in natural numbers $ x, y $.
For $ n = 1 $, the given equation has no solutions in natural numbers. For $ n > 1 $, each pair of numbers $ x_1 = 1^2, y_1 = (n-1)^2, x_2 = 2^2, y_2 = (n-2)^2, \ldots, x_{n-1} = (n-1)^2, y_{n-1} = 1^2 $ is obviously a solution to the given equation, since $ \sqrt{k^2} + \sqrt{(n - k)^2} = k + (n - k) = n $ for $ 0 < k < n $.
We will show that there are no other solutions. If a pair of natural numbers $ x $, $ y $ were a solution to the given equation, and, for example, the number $ x $ were not a square of a natural number, then the equality $ y = (n - \sqrt{x})^2 $ would hold, from which it would follow that $ y - n^2 - x = 2n\sqrt{x} $. On the left side of this equation, there is an integer, so $ 2n \sqrt{x} $ is also an integer. Therefore, $ \sqrt{x} $ is a rational number, $ \sqrt{x} = \frac{m}{n} $. Hence, $ x = \left( \frac{m}{n} \right)^2 $, $ xn^2 = m^2 $. In the prime factorization of the numbers $ n^2 $, $ m^2 $, each prime factor appears with an even exponent. Therefore, due to the uniqueness of the prime factorization of a natural number, it follows that in the prime factorization of the number $ x $, each prime factor also appears with an even exponent,

Thus, $ x $ is a square of a natural number, contrary to the assumption. Similarly, we conclude that no pair of natural numbers $ (x, y) $, in which $ y $ is not a square of a natural number, is a solution to the given equation.
Therefore, the given equation has $ n - 1 $ solutions in natural numbers.