oddprimeasdifferenceoftwosuccessivesquar

Odd Prime as Difference of Two Successive Squares

Any integer <>2 [mod 4] can be written as the difference of two squares

Proof:

a**2==0 or 1 [mod 4]

therefore

a**2 - b**2==0, 1 or 3 [mod 4]

So, if n==2 [mod 4] it cannot be expressed as the difference of two squares

Conversely:

if n==1 or 3 [mod 4], then n+1 and n-1 are both even, so:

n=((n+1)/2)**2 - ((n-1)/2)**2, as difference of squares

(Corollary:

An odd prime is the difference of successive squares)

if n==0 [mod 4]:

n=(n/4 + 1)**2 - (n/4 - 1)**2