Sign in Join
Wiki copytemporary

Revision 2 of 2, by Trev on 2-19-2020. The page as it is now.

Leonardo number/fr

Nombre de Léonard

La suite de Léonard est la suivante :

text
1, 1, 3, 5, 9, 15, 25 ...

Chaque est la somme de ses prédécesseurs + 1, les premiers termes sont 1 et 1.

Méthode récursive

pascal
function LeonardoNumber( n : integer ):integer;
begin
  if n > 1 then result := LeonardoNumber( n - 1 ) + LeonardoNumber( n - 2 ) + 1
    else result := 1;
end;

Emploi du nombre de Fibonacci

pascal
function LeonardoNumber2( n : integer ):integer;
begin
  result := 2 * FibonacciNumber( n + 1) - 1
end;

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.