Sign in Join
Wiki copytemporary

Leonardo number/fi: what changed

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

Title: Leonardo number/fi

OldNewLine
1+# Leonardon numero
2+
3+Leonardon sarja on seuraavanlainen numerosarja:
4+
5+`1, 1, 3, 5, 9, 15, 25 ...`
6+
7+## Leonardon numero rekursiivisellä tavalla
8+
9+``` pascal
10+function LeonardoNumber( n : integer ):integer;
11+begin
12+ if n > 1 then result := LeonardoNumber( n - 1 ) + LeonardoNumber( n - 2 ) + 1
13+ else result := 1;
14+end;
15+```
16+
17+## Leonardon numero käyttämällä [[Fibonacci number/fi|Fibonacin numeroa]]
18+
19+``` pascal
20+function LeonardoNumber2( n : integer ):integer;
21+begin
22+ result := 2 * FibonacciNumber( n + 1) - 1
23+end;
24+```
25+
26+---
27+*From the Free Pascal wiki, page "Leonardo number/fi", 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