If p≡2(mod3) and x=y=1, the number
x+y+xp+yp=2(1+p)
is an integer that is divisible by 3, hence for all such primes the required solutions x,y,n exist.
We now show that solutions can only exist if p≡2(mod3).
Suppose
x=baandy=dc
with positive integers a,b,c,d that satisfy gcd(a,b)=gcd(c,d)=1, is a solution. The given equation is then equivalent to
(a2+pb2)cd+(c2+pd2)ab=3nabcd.(1)
Case (i) Because a3=a(a2+pb2)−pb(ab), any prime factor of gcd(ab,a2+pb2) must divide a. Hence, p is not among these prime factors and such a prime factor must divide pb2=(a2+pb2)−a2. This contradicts gcd(a,b)=1. Hence, gcd(ab,a2+pb2)=1. Similarly, using p∤c,w2 obtain gcd(cd,c2+pd2)=1.
Equation (1) shows that ab divides (a2+pb2)cd. Because gcd(ab,a2+pb2)=1, Euclid's Lemma implies that ab∣cd. Similarly, cd divides (c2+pd2)ab and, using gcd(cd,c2+pd2)=1 we obtain cd∣ab. This shows that ab=cd.
As cd=0 we can now cancel cd in (1) and obtain
a2+pb2+c2+pd2=3nab.
If p≡1(mod3) we obtain that a2+b2+c2+d2≡0(mod3), hence at least one of the four numbers a,b,c,d must be divisible by 3. But because ab=cd, there is a second of these numbers divisible by 3. But then the sum of the squares of the remaining two numbers must also be divisible by 3, which is only possible if these two numbers are divisible by 3 themselves. But this contradicts gcd(a,b)=1.
If p=3 we immediately obtain that a2+c2 is divisible by 3 and so a and c are divisible by 3, contrary to our assumption p∤ac.
Case (ii) If p∣a we can write a=paˉ with some positive integer aˉ and we have p∤b, as gcd(a,b)=1. Equation (1) is then equivalent to
(paˉ2+b2)cd+(c2+pd2)aˉb=3naˉbcd
and we have gcd(aˉ,b)=gcd(c,d)=1. So, we are again in the situation of Case (i), now with aˉ replacing b and c replacing a. Therefore, we need to have p≡2(mod3).
Case (iii) If p∣a and p∣c, we can write a=paˉ and c=pcˉ with positive integers aˉ,cˉ. Equation (1) is then equivalent to
(paˉ2+b2)cˉd+(pcˉ2+d2)aˉb=3naˉbcˉd
with gcd(aˉ,b)=gcd(cˉ,d)=1. Moreover, because p∣a and gcd(a,b)=1 as well as p∣c and gcd(c,d)=1, we also have p∤bd. Hence, we are again in the situation of Case (i) and conclude that we need to have p≡2(mod3) in this case as well.
The final result is that such numbers x,y,n exist for all primes p that satisfy p≡2(mod3) and for no other prime number.