Sign in Join
Wiki copytemporary

Leonardo number/fr: what changed

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

Title: Leonardo number/fr

OldNewLine
1+# Nombre de Léonard
2+
3+La suite de Léonard est la suivante :
4+
5+`1, 1, 3, 5, 9, 15, 25 ...`
6+
7+Chaque est la somme de ses prédécesseurs + 1, les premiers termes sont 1 et 1.
8+
9+## Méthode récursive
10+
11+``` pascal
12+function LeonardoNumber( n : integer ):integer;
13+begin
14+ if n > 1 then result := LeonardoNumber( n - 1 ) + LeonardoNumber( n - 2 ) + 1
15+ else result := 1;
16+end;
17+```
18+
19+## Emploi du [[Fibonacci number/fr|nombre de Fibonacci]]
20+
21+``` pascal
22+function LeonardoNumber2( n : integer ):integer;
23+begin
24+ result := 2 * FibonacciNumber( n + 1) - 1
25+end;
26+```
27+
28+---
29+*From the Free Pascal wiki, page "Leonardo 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