gmp_libmpz_lucnum_ui Method |
Namespace: Math.Gmp.Native
public static void mpz_lucnum_ui( mpz_t ln, uint n )
Public Shared Sub mpz_lucnum_ui ( ln As mpz_t, n As UInteger )
public: static void mpz_lucnum_ui( mpz_t^ ln, unsigned int n )
static member mpz_lucnum_ui : ln : mpz_t * n : uint32 -> unit
The Fibonacci numbers and Lucas numbers are related sequences, so it’s never necessary to call both mpz_fib2_ui and mpz_lucnum2_ui. The formulas for going from Fibonacci to Lucas can be found in GNU MP - Lucas Numbers Algorithm, the reverse is straightforward too.
// Create, initialize, and set the value of ln to 0. mpz_t ln = new mpz_t(); gmp_lib.mpz_init(ln); // Set ln to the 9'th Lucas number. gmp_lib.mpz_lucnum_ui(ln, 9U); // Assert that ln is 76. Assert.IsTrue(gmp_lib.mpz_get_si(ln) == 76); // Release unmanaged memory allocated for ln. gmp_lib.mpz_clear(ln);
' Create, initialize, and set the value of ln to 0. Dim ln As New mpz_t() gmp_lib.mpz_init(ln) ' Set ln to the 9'th Lucas number. gmp_lib.mpz_lucnum_ui(ln, 9UI) ' Assert that ln is 76. Assert.IsTrue(gmp_lib.mpz_get_si(ln) = 76) ' Release unmanaged memory allocated for ln. gmp_lib.mpz_clear(ln)
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.