implement modular square root using the Tonelli-Shanks algorithm