2. Let $p, q, r$ be natural numbers for which $p + r \sqrt{p+q} + q = 2007$.

a) Determine the values that the sum $p + q + r$ can take.

b) Determine the number of all triples $(p, q, r)$ of natural numbers that satisfy the given equation.
2. a) If the natural numbers $p, q, r$ satisfy the given equation, we get the expression

$$
\sqrt{p+q}=\frac{2007-p-q}{r}
$$

so the number $\sqrt{p+q}$ is rational, and thus an integer (the square root of a natural number is either an integer or an irrational number). Therefore, from the equalities

$$
2007=p+r \sqrt{p+q}+q=(p+q)+r \sqrt{p+q}=\sqrt{p+q}(\sqrt{p+q}+r)
$$

we obtain the factorization of the number 2007 into two integer factors $\sqrt{p+q}$ and $\sqrt{p+q}+r$, for which it is clear that

$$
1<\sqrt{p+q}<\sqrt{p+q}+r
$$

From the prime factorization $2007=3^{2} \cdot 223$, we see that there are only two possible cases, which we can clearly write in a table:

| $\sqrt{p+q}$ | $\sqrt{p+q}+r$ |
| :---: | :---: | :---: | :---: | :---: | :---: |
| 3 | 669 |
| 9 | 223 |$\Longleftrightarrow$| $p+q$ | $r$ |
| :---: | :---: |
| 9 | 666 |
| 81 | 214 |$\Longrightarrow \quad \Longrightarrow$| $p+q+r$ |
| :---: |
| 675 |
| 295 |

Thus, the possible values of the sum $p+q+r$ are only two numbers: 675 and 295. (The specific triples $(p, q, r)$ that demonstrate this will not be listed, as we will determine their count in part b).)

b) The equality $p+q+r=675$ will occur if and only if the triple $(p, q, r)$ satisfies the conditions $p+q=9$ and $r=666$; there are exactly as many such triples as there are pairs $(p, q)$ such that $p+q=9$, which is 8.

The equality $p+q+r=295$ will occur if and only if the triple $(p, q, r)$ satisfies the conditions $p+q=81$ and $r=214$; there are exactly as many such triples as there are pairs $(p, q)$ such that $p+q=81$, which is 80.

For a complete solution, award 6 points, of which 5 points for part a) and 1 point for part b). For part a), award only 3 points if the otherwise complete solution lacks an explanation of why the value $\sqrt{p+q}$ is an integer.