Click or drag to resize
gmp_libmpz_jacobi Method
Calculate the Jacobi symbol (a/b).

Namespace:  Math.Gmp.Native
Assembly:  Math.Gmp.Native (in Math.Gmp.Native.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public static int mpz_jacobi(
	mpz_t a,
	mpz_t b
)

Parameters

a
Type: Math.Gmp.Nativempz_t
The first operand integer.
b
Type: Math.Gmp.Nativempz_t
The second operand integer.

Return Value

Type: Int32
The Jacobi symbol (a/b).
Remarks

This is defined only for b odd.

Examples
// Create, initialize, and set the value of a to 11.
mpz_t a = new mpz_t();
gmp_lib.mpz_init_set_ui(a, 11U);

// Create, initialize, and set the value of b to 9.
mpz_t b = new mpz_t();
gmp_lib.mpz_init_set_ui(b, 9U);

// Assert that the Jacobi symbol of (a/b) is 1.
Assert.IsTrue(gmp_lib.mpz_jacobi(a, b) == 1);

// Release unmanaged memory allocated for a and b.
gmp_lib.mpz_clears(a, b, null);
See Also