A presented algorithm for directly constructing the elements of the periodic chain fraction of a square root could have served as the basis for Fermat's method of solving the Pell equation and explicitly finding the two squares composing any prime 4n+1.