Diophantine Equation—2nd Powers

Author

Eric W. Weisstein
January 22, 2009

This notebook downloaded from http://mathworld.wolfram.com/notebooks/DiophantineEquations/DiophantineEquation2ndPowers.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/DiophantineEquation2ndPowers.html.

©2009 Wolfram Research, Inc. except for portions noted otherwise

Euler's Equation  (2^n)-7=(x^2)

Reduce[2^n-7==x^2&&Element[(x|n),Integers]]

Position[Table[Reduce[2^n-7==x^2&&Element[x,Integers]],{n,1000}],_?(#=!=False&),{1},Heads->False]//Flatten

(2^n)=7 (x^2)+(y^2)

Reduce[2^n==7x^2+y^2&&Element[(x|y|n),Integers]&&x>0&&y>0,{x,y}]

Exact solution from Hickerson

a[n_]:=(((1+Sqrt[-7])/2)^n+((1-Sqrt[-7])/2)^n)/2
b[n_]:=(((1+Sqrt[-7])/2)^n-((1-Sqrt[-7])/2)^n)/(2Sqrt[-7])

{a[n],b[n]}//TraditionalForm

FullSimplify[a[n]^2+7b[n]^2]

FullSimplify[7((((((2^(n/2)) Abs[Sin[n ArcTan[(Sqrt[7])]]])/(Sqrt[7]))))^2)+((((2^(n/2)) Abs[Cos[n ArcTan[(Sqrt[7])]]]))^2),n∈Integers]

Transpose[Table[2Abs[{a[n],b[n]}],{n,10}]]

FullSimplify[2Abs[{a[n],b[n]}],n∈Integers]

FullSimplify[2^(-n)ComplexExpand[{Abs[(((1-I (Sqrt[7])))^n)+(((1+I (Sqrt[7])))^n)],
((Abs[(((1-I (Sqrt[7])))^n)-(((1+I (Sqrt[7])))^n)])/(Sqrt[7]))}],n∈Integers]

Transpose[Table[{(2^(1+(n/2))) Abs[Cos[n ArcTan[(Sqrt[7])]]],(((2^(1+(n/2))) Abs[Sin[n ArcTan[(Sqrt[7])]]])/(Sqrt[7]))},{n,10}]//Simplify]

Timing[soln=Table[{x,y}/.{ToRules[Reduce[2^n==7x^2+y^2&&Element[(x|y),Integers]&&x>0&&y>0]]},{n,3,50}];]

soln1=Transpose[Flatten[Function[f,Select[f,And@@OddQ/@#&]]/@soln,1]]

Take[Transpose[soln1],8]

(#+1)/2&/@soln1

(2^n)-2=7 ((x^2)-x)+((y^2)-y)

(Reformulation)

Length/@(soln=Table[{x,y}/.{ToRules[Reduce[2^n-2==7(x^2-x)+(y^2-y)&&Element[(x|y),Integers]&&x>0&&y>0]]},{n,20}])

Transpose[Flatten[soln,1]]

Flatten[soln,1]