Pick a prime and a number . Squaring modulo is instant: compute and you are done. But what about going the other way? Given a result , find an such that:
This is the modular square root problem, and it sits at the heart of number theory. Unlike ordinary square roots, where by reflex, there is no formula that extracts the answer directly. The integers wrap around mod , and the usual tricks — continuous fractions, Newton's method — break down.
Not every even has a square root mod . Exactly half the non-zero residues do (they are called quadratic residues); the other half have none. Euler's criterion settles which half belongs to in one step: if , a root exists.
Knowing a root exists is one thing. Computing it is another. The Tonelli–Shanks algorithm, developed by Alberto Tonelli in 1891 and rediscovered and extended by Daniel Shanks in 1973, does it efficiently using a beautiful descent through the 2-adic structure of .
Comments
Loading comments...