I find the same thing.

BTW, there is no square root of 12 modulo 17 : 

sage: R1.<t>=Zmod(17)[]
sage: %time (t^2-12).roots()
CPU times: user 396 µs, sys: 2 µs, total: 398 µs
Wall time: 407 µs
[]

Direct computation seems faster in this case, either in Zmod(17)

sage: %time [t for t in Zmod(17) if t^2==R1(12)]
CPU times: user 188 µs, sys: 0 ns, total: 188 µs
Wall time: 194 µs
[]

and even faster in SR :

sage: %time [u for u in range(17) if (u^2)%17==12]
CPU times: user 87 µs, sys: 0 ns, total: 87 µs
Wall time: 93.5 µs
[]

Go figure…
​
Le samedi 4 septembre 2021 à 19:30:08 UTC+2, Dikson a écrit :

> square_root_mod_prime seems to run without eventually finishing in some 
> cases.
> tried on my local machine and on https://sagecell.sagemath.org/.
>
> to reproduce:
> from sage.rings.finite_rings.integer_mod import square_root_mod_prime
> square_root_mod_prime(mod(12, 17)) # this doesn't finish
>
> seems like it runs ok when there is a square root. but according to the 
> documentation, it should also finish even when there's no answer, but with 
> a wrong solution.
>
> *sage.rings.finite_rings.integer_mod.square_root_mod_prime(a, p=None)¶ 
> <https://doc.sagemath.org/html/en/reference/finite_rings/sage/rings/finite_rings/integer_mod.html#sage.rings.finite_rings.integer_mod.square_root_mod_prime>Calculates
>  
> the square root of a, where a is an integer mod p; if a is not a perfect 
> square, this returns an (incorrect) answer without checking.*
>
> can someone confirm that this is really a bug or am I doing something 
> wrong?
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/aaee05d0-cc44-461d-be99-277090970de9n%40googlegroups.com.

Reply via email to