Periodic representations and rational approximations of square roots