GMP Native Interface for .NET
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)

public static int mpz_jacobi( mpz_t a, mpz_t b )
Public Shared Function mpz_jacobi ( a As mpz_t, b As mpz_t ) As Integer
public: static int mpz_jacobi( mpz_t^ a, mpz_t^ b )
static member mpz_jacobi : a : mpz_t * b : mpz_t -> int
Parameters
- a
- Type: Math.Gmp.Nativempz_t
The first operand integer. - b
- Type: Math.Gmp.Nativempz_t
The second operand integer.
Return Value
Type: Int32The Jacobi symbol (a/b).

This is defined only for b odd.

// 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);
' Create, initialize, and set the value of a to 11. Dim a As New mpz_t() gmp_lib.mpz_init_set_ui(a, 11UI) ' Create, initialize, and set the value of b to 9. Dim b As New mpz_t() gmp_lib.mpz_init_set_ui(b, 9UI) ' 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, Nothing)
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
