GMP Native Interface for .NET
gmp_libmpz_kronecker Method |
Calculate the Jacobi symbol (a/b) with the Kronecker extension (a/2) = (2/a) when a odd, or (a/2) = 0 when a even.
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_kronecker( mpz_t a, mpz_t b )
Public Shared Function mpz_kronecker ( a As mpz_t, b As mpz_t ) As Integer
public: static int mpz_kronecker( mpz_t^ a, mpz_t^ b )
static member mpz_kronecker : 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) with the Kronecker extension (a/2) = (2/a) when a odd, or (a/2) = 0 when a even.

When b is odd the Jacobi symbol and Kronecker symbol are identical, so mpz_kronecker_ui, etc. can be used for mixed precision Jacobi symbols too.

// Create, initialize, and set the value of a to 15. mpz_t a = new mpz_t(); gmp_lib.mpz_init_set_ui(a, 15U); // Create, initialize, and set the value of b to 4. mpz_t b = new mpz_t(); gmp_lib.mpz_init_set_ui(b, 4U); // Assert that the Kronecker symbol of (a/b) is 1. Assert.IsTrue(gmp_lib.mpz_kronecker(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 15. Dim a As New mpz_t() gmp_lib.mpz_init_set_ui(a, 15UI) ' Create, initialize, and set the value of b to 4. Dim b As New mpz_t() gmp_lib.mpz_init_set_ui(b, 4UI) ' Assert that the Kronecker symbol of (a/b) is 1. Assert.IsTrue(gmp_lib.mpz_kronecker(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.
