# Find the values:

1. Sep 8, 2008

### Euler_Euclid

Find all values of p and q if p and q are prime numbers, $$p^2 + q^2 + 7pq$$ is a perfect square.

2. Sep 8, 2008

### CRGreathouse

(p, p), (3, 11), (11, 3) all work. I'd suggest trying the equation mod 4 or 36 to see if you can rule out others.

3. Sep 8, 2008

### Euler_Euclid

please explain the whole solution. It was an Olympiad question and all of my friends couldn't do it.

4. Sep 8, 2008

### praharmitra

$$p^2 + 7pq + q^2$$

For p = q, it reduces to $$9p^2 = (3p)^2$$. It therefore is a perfect square.

You can put p = 2 and show that only q = 2 gives a feasible solution, which is covered in p = q. Thus, we conclude that p,q are both odd, and hence the value of the expression is odd

For other values

$$p^2 + 7pq + q^2 = (p+q)^2 + 5pq = k^2$$
$$5pq = k^2 - (p+q)^2 = (k - p - q)(k + p + q)$$
Thus, since p and q are primes, the only possible solutions are

$$1.k-p-q = 5, k+p+q = pq$$

From the above equations we get k = 5+p+q and hence
$$5+2p+2q = pq => 5 + 2q = p(q-2) => p = \frac{2q+5}{q-2} = 2 + \frac{9}{q - 2}$$
$$=> q - 2 = 1, 3, or 9$$

This gives (p,q) = (11,3) or (5,5) or (3,11)

The other possibilites are

$$2. k-p-q = 5p, k+p+q = q$$(no solution)
$$3. k+p+q = 5, k-p-q = pq$$(no solution)
$$4. k+p+q = 5p, k-p-q = q$$(gives p = q)

Thus, the only possible solutions are (p,p), (3,11) and (11,3)

5. Sep 9, 2008

### snipez90

Nice solution praharmitra. I saw the decomposition as well but didn't complete the solution since I didn't analyze the small cases at first. I have to remember that even/odd parity analysis is always a good first step in number theory equations.