repl.txt (907B)
1 2 {{alias}}( n ) 3 Computes the nth Lucas number. 4 5 Lucas numbers follow the recurrence relation 6 7 L_n = L_{n-1} + L_{n-2} 8 9 with seed values L_0 = 2 and L_1 = 1. 10 11 If `n` is greater than `76`, the function returns `NaN`, as larger Lucas 12 numbers cannot be accurately represented due to limitations of double- 13 precision floating-point format. 14 15 If not provided a nonnegative integer value, the function returns `NaN`. 16 17 If provided `NaN`, the function returns `NaN`. 18 19 Parameters 20 ---------- 21 n: integer 22 Input value. 23 24 Returns 25 ------- 26 y: integer 27 Lucas number. 28 29 Examples 30 -------- 31 > var y = {{alias}}( 0 ) 32 2 33 > y = {{alias}}( 1 ) 34 1 35 > y = {{alias}}( 2 ) 36 3 37 > y = {{alias}}( 3 ) 38 4 39 > y = {{alias}}( 4 ) 40 7 41 > y = {{alias}}( 77 ) 42 NaN 43 > y = {{alias}}( NaN ) 44 NaN 45 46 See Also 47 -------- 48