Leonardo numbers: Difference between revisions

Add Plain English
m (→‎{{header|Factor}}: change output to reflect previously fixed typo)
(Add Plain English)
Line 1,443:
<pre>Leonardo (1 1 3 5 9 15 25 41 67 109 177 287 465 753 1219 1973 3193 5167 8361 13529 21891 35421 57313 92735 150049)
Fibonacci (0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368)</pre>
 
=={{header|Plain English}}==
<lang plainenglish>To run:
Start up.
Write "First 25 Leonardo numbers:" on the console.
Show 25 of the Leonardo numbers starting with 1 and 1 and using 1 for the add number.
Write "First 25 Leonardo numbers with L(0)=0, L(1)=1, add=0:" on the console.
Show 25 of the Leonardo numbers starting with 0 and 1 and using 0 for the add number.
Wait for the escape key.
Shut down.
 
To show a number of the Leonardo numbers starting with a first number and a second number and using an add number for the add number:
If the number is less than 2, exit.
Privatize the number.
Privatize the first number.
Privatize the second number.
Subtract 2 from the number.
Write the first number then " " then the second number on the console without advancing.
Loop.
If a counter is past the number, write "" on the console; exit.
Swap the first number with the second number.
Put the first number plus the second number plus the add number into the second number.
Write the second number then " " on the console without advancing.
Repeat.</lang>
{{out}}
<pre>
First 25 Leonardo numbers:
1 1 3 5 9 15 25 41 67 109 177 287 465 753 1219 1973 3193 5167 8361 13529 21891 35421 57313 92735 150049
First 25 Leonardo numbers with L(0)=0, L(1)=1, add=0:
0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368
</pre>
 
=={{header|PureBasic}}==
1,808

edits