This site is supported by donations to The OEIS Foundation.
Template:Lucas/doc
From OeisWiki
Lucas}} mathematical function template returns the
th Lucas number, where
is an integer. It uses Binet’s closed-form formula for the Lucas numbers.
The {{n |
n |
Contents
Usage
- {{Lucas|integer}}
Valid input
An integer argument.
Examples
Examples with valid input
Code Result {{Lucas|-5}} -11 {{Lucas|-4}} 7 {{Lucas|-3}} -4 {{Lucas|-2}} 3 {{Lucas|-1}} -1 {{Lucas|0}} 2 {{Lucas|1}} 1 {{Lucas|2}} 3 {{Lucas|3}} 4 {{Lucas|4}} 7 {{Lucas|5}} 11 {{Lucas|8}} 47 {{Lucas|10}} 123
Examples with invalid input
Code Result (returns an error message) {{Lucas}} Lucas error: Argument must be an integer {{Lucas|3.25}} Lucas error: Argument must be an integer {{Lucas|rabbits}} Lucas error: Argument must be an integer
Code
{{ifint| ( {{{1|NAN}}} ) | {{#expr: ( ((1 + 5^(1/2)) / 2)^( {{{1}}} ) + ((1 - 5^(1/2)) / 2)^( {{{1}}} ) ) round 0 }} | {{error| Lucas error: Argument must be an integer }} }}
See also
- {{Fibonacci}}
- {{Lucas}}
- {{Golden ratio}} or {{phi}}