IntTryJacobi
Description
Compute the Jacobi symbol (a/n).
Parameters
| Name | Direction | Description |
|---|---|---|
out |
out | Destination for the Jacobi symbol; one of -1, 0, or 1 on success. |
a |
in | Numerator |
n |
in | Odd positive modulus |
Usage example (from documentation)
int symbol = 0;
bool ok = IntTryJacobi(&symbol, &a, &n);Success
Returns true and writes the Jacobi symbol to *out. Neither operand is modified.
Failure
Returns false when n is even, zero, or otherwise invalid for the Jacobi computation. *out is left untouched.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Int.c:1945:
}
bool IntTryJacobi(int *out, const Int *a, const Int *n) {
ValidateInt(a);
ValidateInt(n);- In
Int.c:2010:
int IntJacobiWithError(const Int *a, const Int *n, bool *error) {
int out = 0;
bool ok = IntTryJacobi(&out, a, n);
if (error) {- In
Int.c:2471:
{
int jacobi = 0;
if (!IntTryJacobi(&jacobi, &a, modulus) || jacobi != 1) {
IntDeinit(&a);
return false;- In
Int.c:2530:
int jacobi = 0;
if (!IntTryJacobi(&jacobi, &z, modulus)) {
IntDeinit(&q);
IntDeinit(&z);- In
Int.Leak.c:535:
int jr = 0;
bool ok = IntTryJacobi(&jr, &x, &n);
// a case where gcd(a,n) != 1 -> the *out=0 branch (frees nn at 1998)
- In
Int.Leak.c:541:
Int n2 = IntFrom(9u, a); // odd, gcd(15,9)=3
int jr2 = 0;
ok = ok && IntTryJacobi(&jr2, &x2, &n2) && jr2 == 0;
IntDeinit(&x);- In
Int.Math.c:1080:
int symbol = 99;
bool error = false;
bool result = !IntTryJacobi(&symbol, &a, &n);
result = result && (IntJacobi(&a, &n, &error) == 0);- In
Int.Math.c:2955:
int symbol = 99;
bool ok = IntTryJacobi(&symbol, &a, &n);
bool result = ok && (symbol == -1);
Last updated on