gmp_lib.mpz_lucnum_ui Method

GMP Native Interface for .NET

gmp_libmpz_lucnum_ui Method
Sets ln to to L[n], the n’th Lucas number.

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 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 

Parameters

ln
Type: Math.Gmp.Nativempz_t
The L[n] result.
n
Type: SystemUInt32
The operand integer.
Remarks

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.

Examples
// 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.

See Also