# Is this the simplest way to generate primes as a sum of two consecutive squares?

We start with looking for primes that can be expressed as a difference between two consecutive cubes which we write as a^3-b^3=p. (Here, we ignore the question of how many primes are there between two cubes). The difference between two cubes is obviously not always a prime. When it is, we can write a^3-b^3=p. Now a^3-b^3 = (a-b)*(a^2 + b^2 + ab) = p. Since a and b are consecutive integers ( a>b ), then we can drop the factor (a-b)=1. Now we have a simple expression to generate primes that are the sum of two consecutive squares. q=p-ab=a^2+b^2, where q is a prime. It is also obvious that q is not always a prime. Below are listed the primes (P) generated as a difference between two consecutive cubes and then the primes (Q) that are the sum of two consecutive squares. We start with 3^3-2^3 = 19 = 3^2 + 2^2 + 2*3. Then we simply substract the product 2*3 from 19 to get 13 = 2^2 + 3^2. P={19,37,61,127,271,331,397,547,631...) and Q=(13,41,61,113,181,313,421,613,761,1013...). A prime which is equal to a difference between two consecutive cubes does not always generate a prime that is the sum of two consecutive squares. But the number generated is of course always a sum of two consecutive squares.

• That's why I used the word consecutive. – user25406 Oct 5 '16 at 13:40
• if $a=b+1$ then you are allowed to make it explicit in all your formulas what don't you understand with that ? – reuns Oct 5 '16 at 13:41
• I edited the title back. I thought "squares" would have been a typo. – Peter Oct 5 '16 at 13:51
• It won't make any difference. 13 will still be equal to 3^2 + 2^2. And 3=2+1. Now, if I am not seeing what you have in mind, please post all the details. – user25406 Oct 5 '16 at 13:52
• It should be much easier to consider $a^2+(a+1)^2=2a^2+2a+1$ and simply check for which $a's$, the expression gives a prime number. – Peter Oct 5 '16 at 13:54