Click or drag to resize
gmp_libmpz_congruent_2exp_p Method
Return non-zero if n is congruent to c modulo 2^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_congruent_2exp_p(
	mpz_t n,
	mpz_t c,
	mp_bitcnt_t b
)

Parameters

n
Type: Math.Gmp.Nativempz_t
An operand integer.
c
Type: Math.Gmp.Nativempz_t
The remainder of the division by 2^b.
b
Type: Math.Gmp.Nativemp_bitcnt_t
The exponent of the power of two divisor.

Return Value

Type: Int32
Non-zero if n is congruent to c modulo 2^b.
Remarks

n is congruent to c mod 2^b if there exists an integer q satisfying n = c + q * 2^b.

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

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

// Assert that n is congruent to c mod 2^3.
Assert.IsTrue(gmp_lib.mpz_congruent_2exp_p(n, c, 3U) > 0);

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