Tonelli-Shanks algorithm: Difference between revisions

m
(New post.)
m (→‎{{header|Wren}}: Minor tidy)
 
(2 intermediate revisions by one other user not shown)
Line 1,430:
result = ( result + b ) % modulus;
};
b = ( b *<< 21 ) % modulus;
a >>= 1;
}
Line 1,444:
uint64_t result = 1;
while ( exponent > 0 ) {
if ( ( exponent & 1 ) == 1 ) {
result = multiply_modulus(result, base, modulus);
}
Line 4,022:
{{libheader|Wren-dynamic}}
{{libheader|Wren-big}}
<syntaxhighlight lang="ecmascriptwren">import "./dynamic" for Tuple
import "./big" for BigInt
 
var Solution = Tuple.create("Solution", ["root1", "root2", "exists"])
9,479

edits