Lucas
Returns the nth Lucas number.
Syntax
-
Lucas(n)-
nis a non-negative integer
-
Description
If n is a non-negative integer, then Lucas(n) is the nth Lucas number. The Lucas numbers L(n) are defined recursively by
⎧ 2 if n = 0
L(n) = ⎨ 1 if n = 1
⎩ L(n − 1) + L(n − 2) otherwise.
Examples
SequenceVector(0, 20) @ Lucas
(2, 1, 3, 4, 7, 11, 18, 29, 47, 76, 123, 199, 322, 521, 843, 1364, 2207, 3571, 5778, 9349, 15127)
filter(SequenceVector(0, 50) @ Lucas, IsPrime)
(2, 3, 7, 11, 29, 47, 199, 521, 2207, 3571, 9349, 3010349, 54018521, 370248451, 6643838879)
∑(1/Lucas(n), n, 1, 100)
1.96285817321
Lucas(100)/Fibonacci(100)
2.2360679775 (=√5)