Skip to content

Odd Period Square Roots (64)

In Problem 64, we're asked to look at the continued fractions of the square roots of natural numbers N$N and investigate their the periodic part of the expansion. Specifically, we are asked how many expansion of N for N10000 have an odd period.

With the library for continued fractions, we can directly get the prefix and period part for every N. We just check for odd length and count these.