John Cremona on Sat, 24 Nov 2001 12:21:45 +0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

bug in 2-adic sqrt


This would seem to be a bug in 2-adic sqrt, in 2.1.1.  I am well aware of the
fact that one loses one bit of 2-adic precision doing this, but we seem to be
losing two bits.

Example:

(12:25) gp > a=-71+O(2^5)
%1 = 1 + 2^3 + 2^4 + O(2^5)
(12:25) gp > b=sqrt(a)
%2 = 1 + 2^2 + 2^3 + O(2^4)
(12:25) gp > b^2-a
%3 = 2^4 + O(2^5)

Here a = -71 (mod 32) = 25 (mod 32), and b^2=a (mod 32)  has general solution 5
(mod 16), so the "right" answer is surely

(12:25) gp > c=5+O(2^4)
%4 = 1 + 2^2 + O(2^4)
(12:26) gp > c^2-a
%5 = O(2^5)

[What I really would like is to be able to ask for sqrt(Mod(-71,32)) and get
Mod(5,16); I am only using 2-adics to simulate this.]

John Cremona