For any integer d that is not a perfect square, the continued fraction for √d has a pattern that we see above.

The coefficients after the first one are periodic.

The cycle consists of a palindrome followed by a single number.

The last number in the cycle is twice the leading coefficient.

In the example above, the periodic part is {1, 2, 1, 6}. The palindrome is {1, 2, 1} and 6 is twice the initial coefficient 3.

Another way to state the third point above is to say that the leading coefficient is the integer part of the square root of d, i.e. ⌊√d⌋, and the last coefficient in each period is 2⌊√d⌋.

## Leave a Reply