Home > Uncategorized > Panaitopol primes – simple representation

## Panaitopol primes – simple representation

A prime number ${p}$ is called a Panaitopol prime if ${\displaystyle p = \frac{x^4-y^4}{x^3+y^3}}$. I stumbled upon these weird prime numbers while working on problem 291 from Project Euler.

While searching a bit about the problem I did a brute force check to find the first such primes and I found the following values:

$\displaystyle 5, 13, 41, 61, 113, 181, 313, 421, 613, 761.$

Since this was going nowhere I plugged these into the OEIS search engine and bam: it seems they are precisely the primes which can be written in the form ${p=n^2+(n+1)^2}$. If this latter formulation holds, then the problem can be solved immediately, since searching for primes of the form ${n^2+(n+1)^2}$ is much easier than testing the first formula. Now how do we prove this? Suppose ${\displaystyle p = \frac{x^4-y^4}{x^3+y^3}}$, which is equivalent, after simplifying ${x+y}$, to
$\displaystyle p = \frac{(x-y)(x^2+y^2)}{x^2-xy+y^2}\Rightarrow p(x^2-xy+y^2)=(x-y)(x^2+y^2).$

Note that we necessarily have ${x\neq y}$. Now recall that ${p}$ is prime, so if ${p}$ divides ${x-y}$ we must have ${x^2+y^2|x^2-xy+y^2}$ which is false, since a positive number cannot divide a number smaller than itself (I leave you the task of seeing why ${x^2-xy+y^2}$ cannot be zero). Therefore it remains that ${p|x^2+y^2}$ and ${x-y|x^2-xy+y^2}$. Since ${x-y|x^2-xy}$ and ${x-y|y^2-xy}$ it follows that ${x-y}$ divides ${x^2,y^2}$ and ${xy}$. Therefore we can write
$\displaystyle x^2=a(x-y),\ y^2=b(x-y),\ xy = c(x-y).$

Multiply the first two relations and square the third to get ${c^2=ab}$. Furthermore, we have
$\displaystyle (x-y)^2 = (a+b-2c)(x-y)$

so ${x-y = a+b-2c}$. Now let’s see what remains of the initial ${p}$
$\displaystyle p = \frac{(a+b-2c)(a+b)(x-y)}{(a-c+b)(x-y)}= \frac{(a+b-2c)(a+b)}{a+b-c}.$

Now let’s suppose that ${d=\gcd(a,b,c)}$ and denote ${a_1=a/d,b_1=b/d,c_1=c/d}$. Then we have
$\displaystyle p = \frac{(a_1+b_1-2c_1)d(a_1+b_1)}{a_1+b_1-c_1}.$

Now let’s note that if ${q}$ is a common prime factor of ${a_1+b_1-2c_1}$ and ${a_1+b_1-c_1}$ then it follows immediately that ${q}$ divides ${x,y,a_1,b_1,c_1}$, contradicting the choice of ${d}$ above. Therefore we can assume that ${\gcd(a_1+b_1+c_1,a_1+b_1-2c_1)=1}$. This means that, for the above fraction to simplify we need to have ${a_1+b_1-c_1|d(a_1+b_1)}$. Furthermore, the ratio ${\displaystyle \frac{d(a_1+b_1)}{a_1+b_1-c_1}}$ is strictly greater than ${1}$. Moreover, ${\gcd(a_1+b_1,a_1+b_1-c_1)=1}$ so the previous fraction is in fact just ${a_1+b_1}$. Since ${p}$ is prime, this forces the relation ${a_1+b_1-2c_1=1}$, which, since ${c_1=\sqrt{a_1,b_1}}$, gives us
$\displaystyle \sqrt{a_1}-\sqrt{b_1}=1.$

Therefore ${a_1=(n+1)^2}$ and ${b_1=n^2}$ for some positive integer ${n}$. In conclusion
$\displaystyle p = a_1+b_1=n^2+(n+1)^2.$

Now if we have ${a,b,c}$ we can retrace the construction to find a the corresponding ${x}$ and ${y}$. Note that in addition to ${x-y = a+b-2c = d((n+1)^2+n^2-2n(n+1)) = d}$ we also have ${x+y = a-b = d(2n+1)}$. Choosing ${d=n^2+n+1}$ we get exactly
$\displaystyle \frac{x^4-y^4}{x^3+y^3}=n^2+(n+1)^2.$