Continued fractions with period 1

A while back I wrote about continued fractions of square roots. That post cited a theorem that if d is not a perfect square, then the continued fraction representation of d is periodic. The period consists of a palindrome followed by 2⌊√d⌋. See that post for details and examples.

One thing the post did not address is the length of the period. The post gave the example that the continued fraction for √5 has period 1, i.e. the palindrome part is empty.

\sqrt{5} = 2 + \cfrac{1}{4+ \cfrac{1}{4+ \cfrac{1}{4+ \cfrac{1}{4+ \ddots}}}}

There’s a theorem [1] that says this pattern happens if and only if d = n² + 1. That is, the continued fraction for √d is periodic with period 1 if and only if d is one more than a square. So if we wanted to find the continued fraction expression for √26, we know it would have period 1. And because each period ends in 2⌊√26⌋ = 10, we know all the coefficients after the initial 5 are equal to 10.

\sqrt{26} = 5 + \cfrac{1}{10+ \cfrac{1}{10+ \cfrac{1}{10+ \cfrac{1}{10+ \ddots}}}}

[1] Samuel S. Wagstaff, Jr. The Joy of Factoring. Theorem 6.15.