# A Procedure to Compute the Digit Sequence of a Square Root

A Procedure to Compute the Digit Sequence of a Square Root

This Demonstration visualizes a procedure for generating the base-2 digit sequence of a square root. From A New Kind of Science, p. 141: "To find , start by setting and . Then at each step apply the rule . The result is that the base-2 digits of turn out to correspond exactly to the digits of . If is not between 1 and 4, it must be multiplied or divided by an appropriate power of 4 before starting the procedure."

n

r=n

s=0

{r,s}→If[r≥s+1,{4(r-s-1),2(s+2)},{4r,2s}]

s

n

n

The digit sequence of r is shown on the left, while the digit sequence of —which corresponds exactly to —is shown on the right. Black cells represent ones, and gray cells represent zeros.

s

n