Square Root Algorithms

Author

Eric W. Weisstein
April 14, 2004

This notebook downloaded from http://mathworld.wolfram.com/notebooks/Algorithms/SquareRootAlgorithms.nb.

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

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

Recurrence

a[1,n_]:=1
b[1,n_]:=1
a[i_,n_]:=a[i,n]=a[i-1,n]+b[i-1,n]n
b[i_,n_]:=b[i,n]=a[i-1,n]+b[i-1,n]

Factor[Table[a[i,n]/b[i,n],{i,6}]]

With[{n=2},
Table[a[i,n]/b[i,n],{i,10}]
]

With[{n=3},
Table[a[i,n]/b[i,n],{i,10}]
]

Continued Fractions of (Sqrt[2])

Table[FromContinuedFraction[ContinuedFraction[Sqrt[2],n]],{n,20}]

Denominator[%]

a[0]:=1
a[1]:=1
a[n_]:=2a[n-1]+a[n-2]

Table[a[n],{n,10}]

<<DiscreteMath`RSolve`

FullSimplify[RSolve[{a[n]==2a[n-1]+a[n-2],a[0]==1,a[1]==1},a[n],n]]

Expand[Table[(1/2) ((((1-(Sqrt[2])))^n)+(((1+(Sqrt[2])))^n)),{n,10}]]

FullSimplify[RSolve[{a[n]==2a[n-1]+a[n-2],a[0]==0,a[1]==1},a[n],n]]

Expand[Table[((-(((1-(Sqrt[2])))^n)+(((1+(Sqrt[2])))^n))/(2 (Sqrt[2]))),{n,10}]]

Continued Fractions of (Sqrt[3])

Table[FromContinuedFraction[ContinuedFraction[Sqrt[3],n]],{n,20}]

a[0]:=1
a[1]:=1
a[n_]:=2a[n-1]+a[n-2]

Table[a[n],{n,10}]