Tonelli-Shanks algorithm: Difference between revisions
m
→{{header|Sidef}}: code simplifications
Thundergnat (talk | contribs) (→{{header|Perl 6}}: Add Perl 6) |
m (→{{header|Sidef}}: code simplifications) |
||
Line 542:
legendre(n, p) == 1 || die "not a square (mod p)"
var q = p-1
var s =
▲ return powmod(n, (p + 1) >> 2, p)
▲ if (legendre(z, p) == -1) {
var r = powmod(n, (q + 1) >> 1, p)
var t = powmod(n, q, p)
|