Sign in Join
Wiki copytemporary

Lucas number/fr: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: Lucas number/fr

OldNewLine
1+# Lucas number
2+
3+La suite de Lucas est la suivante :
4+
5+`2, 1, 3, 4, 7, 11, 18, 29, 47, ...`
6+
7+Définie comme la [[Fibonacci number/fr|suite de Fibonacci]] mais les premiers termes sont 2 et 1.
8+
9+## Méthode récursive
10+
11+``` pascal
12+
13+function LucasNumber( n : integer ): integer;
14+begin
15+ if n > 1 then
16+ result := LucasNumber( n - 1 ) + LucasNumber( n - 2 )
17+ else
18+ if n = 0 then
19+ result := 2
20+ else
21+ result := 1;
22+end;
23+```
24+
25+## Emploi du [[Fibonacci number/fr|nombre de Fibonacci]]
26+
27+``` pascal
28+
29+function LucasNumber2( n : integer ): integer;
30+begin
31+ result := FibonacciNumber( n + 1 ) + FibonacciNumber( n - 1 );
32+end;
33+```
34+
35+---
36+*From the Free Pascal wiki, page "Lucas number/fr", as it stood on 2020-02-19 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history