p2−p+1=q3
We can consider this as a quadratic equation in the variable p, with q considered a parameter. The equation can then be written in slightly more standard form:
p2−p+(1−q3)=0
The discriminant is 1−4(1−q3)=4q3−3.
For there to be an integer solution, the discriminant must be a perfect square. Unfortunately, it's not at all clear how to find all the instances where[math]4q^3-3[/math] is a square. So we need to try something else.
It'll be good to factor the LHS to make it a product, but p^2-p+1 doesn't factor over the rationals, We may observe though that subtracting 1 from both sides of the equation allows each of them to be factored:
p2−p=q3−1
p(p−1)=(q−1)(q2+q+1)
Since p is prime, it must divide one of the factors on the right. But it is clearly greater than q (since q3=p2−p+1), therefore it cannot divide q-1. So p must divide q2+q+1.
We may now write q^2+q+1=mp for some natural number [math]m[/math]. Equation (1) above now reads
p(p-1) = (q-1)mp
p-1 = m(q-1)
p = mq-m+1
Multiplying this by m we get a quadratic equation in q with parameter m:
mp=m2q−m2+m
q2+q+1=m2q−m2+m
q2+(1−m2)q+(m2−m+1)=0
Once again, we have a quadratic equation with a solution q that is known to be an integer, so the discriminant must be a perfect square.
Delta(m) =(1−m2)2−4(m2−m+1)=m4−6m2+4m−3
How can we determine the values of m for which Delta(m) is a perfect square? The trick is to observe that if it's the square of something, that something should be pretty close to m2−3. Why? Because
(m2−3)2=m4−6m2+9
which is very similar to our Delta. The difference is that Delta has 4m-3 where our perfect square has a 9 This works great if m=3, and indeed Delta(3)=36 is a square. We can quickly rule out m=1,2. What if m>3?
Well, then our Delta overshoots the perfect square (m2−3)2. The next perfect square is (m2−2)2. But... that's too big. You see,
(m2−2)2=m4−4m2+4
and this is more than Delta (an easy inequality).
Therefore Delta(m) is indeed a perfect square when m=3, but we proved that it is not a square for any other value of m. Finally, choosing m=3 yields
q2−8q+7=0
so q=1(not a prime) or q=7and3p=q2+q+1=58sop=19.