Sign in Join
Wiki copytemporary

Lucas number/fr: what changed

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

OldNewLine
11# Lucas number
22
33La suite de Lucas est la suivante :
44
5-`2, 1, 3, 4, 7, 11, 18, 29, 47, ...`
5+```text
6+2, 1, 3, 4, 7, 11, 18, 29, 47, ...
7+```
68
79Définie comme la [[Fibonacci number/fr|suite de Fibonacci]] mais les premiers termes sont 2 et 1.
810
911## Méthode récursive
1012
1113``` pascal
1214
1315function LucasNumber( n : integer ): integer;
1416begin
1517 if n > 1 then
1618 result := LucasNumber( n - 1 ) + LucasNumber( n - 2 )
1719 else
1820 if n = 0 then
1921 result := 2
2022 else
2123 result := 1;
2224end;
2325```
2426
2527## Emploi du [[Fibonacci number/fr|nombre de Fibonacci]]
2628
2729``` pascal
2830
2931function LucasNumber2( n : integer ): integer;
3032begin
3133 result := FibonacciNumber( n + 1 ) + FibonacciNumber( n - 1 );
3234end;
3335```
3436
3537---
3638*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