![]() (Note that if r is a square root of x, then so is -r. At the end, r and t/2-r will be square roots of x modulo t/2. The idea is that at each iteration, you add one bit onto r, the "current" square root of x each square root is accurate modulo a larger and larger power of 2, namely t/2. ![]() (Note: untested code if it doesn't work, try t=2 or 8.) The basic structure of Hensel's lemma is the following. (I don't think it's applicable directly, but it works with some modifications.) Before doing that, I divide out all powers of 2 with a binary search:Īt this point, for our number to be a square, it must be 1 mod 8.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |