It is easy to check that (3,3,n) (n=2,3,…) satisfy both equations. Now let (p,q,n) be another triple satisfying the condition. Then we must have p=q, p=3, q=3. We may assume that q>p≥5.
If n=2, then q2∣p4−34, or q2∣(p2−32)(p2+32). Then either q2∣p2−32 or q2∣p2+32, since q cannot divide both p2−32 and p2+32. On the other hand, 0<p2−32<q2, 21(p2+32)<p2<q2. This leads to a contradiction.
So n≥3. From pn∣qn+2−3n+2, qn∣pn+2−3n+2, we get
pn∣pn+2+qn+2−3n+2,qn∣pn+2+qn+2−3n+2.
Since p<q, and p, q primes, we have
pnqn∣pn+2+qn+2−3n+2.1◯
Then pnqn≤pn+2+qn+2−3n+2<2qn+2. That means pn<2q2.
As qn∣pn+2−3n+2 and p>3, we have qn≤pn+2−3n+2<pn+2, and consequently q<p1+n2. Since pn<2q2, we have pn<2p2+n4<p3+n4. So n<3+n4, and we get n=3. Then p3∣q5−35, q3∣p5−35.
From 55−35=2×11×131, we know p>5; from p3∣q5−35 we know p∣q5−35. By Fermat's little theorem, we get p∣qp−1−3p−1. Then p∣q(5,p−1)−3(5,p−1).
If (5,p−1)=1, then p∣q−3. From
q−3q5−35=q4+q3⋅3+q2⋅32+q⋅33+34≡5×34(modp)
and p≥5, we get p∤q−3q5−35. So p3∣q−3. From q3∣p5−35, we get q3≤p5−35<p5=(p3)35<q35. This is a contradiction.
So we have (5,p−1)=1, and that means 5∣p−1. In a similar way, we have 5∣q−1. As (q,p−3)=1 (since q>p≥7) and q3∣p5−35, we know that q3∣p−3p5−35. Then
q3≤p−3p5−35=p4+p3⋅3+p2⋅32+p⋅33+34.
From 5∣p−1 and 5∣q−1, we get p≥11 and q≥31. So
q3≤p4(1+p3+(p3)2+(p3)3+(p3)4)
<p4⋅1−p31≤811p4.
Then we have p>(118)41q43. Consequently,
p3q3p5+q5−35<q3p2+p3q2<q1+(811)4331411<1.
But this contradicts ① which says p3q3∣p5+q5−35.
So we reach the conclusion that (3,3,n) (n=2,3,…) are all the triples that satisfy the conditions.