gmp_libmpz_legendre Method |
Namespace: Math.Gmp.Native
public static int mpz_legendre( mpz_t a, mpz_t p )
Public Shared Function mpz_legendre ( a As mpz_t, p As mpz_t ) As Integer
public: static int mpz_legendre( mpz_t^ a, mpz_t^ p )
static member mpz_legendre : a : mpz_t * p : mpz_t -> int
This is defined only for p an odd positive prime, and for such p it’s identical to the Jacobi symbol.
// Create, initialize, and set the value of a to 20. mpz_t a = new mpz_t(); gmp_lib.mpz_init_set_ui(a, 20U); // Create, initialize, and set the value of p to 11. mpz_t p = new mpz_t(); gmp_lib.mpz_init_set_ui(p, 11U); // Assert that the Legendre symbol of (a/p) is 1. Assert.IsTrue(gmp_lib.mpz_legendre(a, p) == 1); // Release unmanaged memory allocated for a and p. gmp_lib.mpz_clears(a, p, null);
' Create, initialize, and set the value of a to 20. Dim a As New mpz_t() gmp_lib.mpz_init_set_ui(a, 20UI) ' Create, initialize, and set the value of p to 11. Dim p As New mpz_t() gmp_lib.mpz_init_set_ui(p, 11UI) ' Assert that the Legendre symbol of (a/p) is 1. Assert.IsTrue(gmp_lib.mpz_legendre(a, p) = 1) ' Release unmanaged memory allocated for a and p. gmp_lib.mpz_clears(a, p, 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.