Ask Your Question

Revision history [back]

This does work

sage: sage: n = 20
sage: FF = IntegerModRing(2^n)
sage: FF(1 + 2^(n - 1)).sqrt()
262143

Your number n=216 is just too big (for Sage).

A reasonable algorithm does not have been implemented for that ring. This is a shame as it does workwork in p-adics.

sage: R = Zp(2, prec=300)
sage: R
2-adic Ring with capped relative precision 300
sage: R(1 + 2^(216 - 1))
1 + 2^215 + O(2^300)
sage: R(1 + 2^(216 - 1)).sqrt()
1 + 2^214 + O(2^299)

I guess this is what you should be using if you are interested in IntegerModRing(p^k).

For IntegerModRing Sage uses a generic algorithm that only works with small numbers

sage: sage: n = 20
sage: FF = IntegerModRing(2^n)
sage: FF(1 + 2^(n - 1)).sqrt()
262143

Your number n=216 is just too big (for Sage).