Wolfram's Iteration

Author

Eric W. Weisstein
June 7, 2004

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

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

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

Code

BinarySqrtList[n_,its_]:=NestList[Function[{u,v},If[u>=v+1,{4(u-v-1),2(v+2)},{4u,2v}]]@@#&,{n,0},its]

BinarySqrt[n_,its_]:=FromDigits[{IntegerDigits[BinarySqrtList[n,its][[-1,-1]],2],1},2]

Example

(Sqrt[2])

l=BinarySqrtList[2,10]

Transpose[l]

First/@(RealDigits[#,2]&/@Last/@l)//ColumnForm

RealDigits[Sqrt[2],2,20]

pq=Table[BinarySqrt[2,n],{n,15}]

Through[{Numerator,Denominator}[pq]]

%//N

(Sqrt[3])

l=BinarySqrtList[3,10]

Transpose[l]

First/@(RealDigits[#,2]&/@Last/@l)//ColumnForm

Table[BinarySqrt[3,n],{n,15}]

%//N

Figure

l2=BinarySqrtList[2,50];

Show[GraphicsArray[RasterGraphics[#[[1]],MeshStyle->{GrayLevel[.7]},
PlotLabel->TraditionalForm[#[[2]]]]&/@Transpose[{Map[PadRight[#,1+Floor[Log[2,Max[Flatten[l2]]]]]&,IntegerDigits[Transpose[l2],2],{2}],{(Subscript[u, n]),(Subscript[v, n])}}]
]]