Leonardo numbers: Difference between revisions

Added AutoHotkey
m (→‎JS ES6: Added line breaks, applied JS Beautify to console.log version (legibility))
(Added AutoHotkey)
Line 351:
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610
610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368</pre>
 
=={{header|AutoHotkey}}==
<lang AutoHotkey>Leonardo(n, L0:=1, L1:=1, step:=1){
if n=0
return L0
if n=1
return L1
return Leonardo(n-1, L0, L1, step) + Leonardo(n-2, L0, L1, step) + step
}</lang>
Examples:<lang AutoHotkey>output := "1st 25 Leonardo numbers, starting at L(0).`n"
loop, 25
output .= Leonardo(A_Index-1) " "
output .= "`n`n1st 25 Leonardo numbers, specifying 0 and 1 for L(0) and L(1), and 0 for the add number:`n"
loop, 25
output .= Leonardo(A_Index-1, 0, 1, 0) " "
MsgBox % output
return</lang>
{{out}}
<pre>1st 25 Leonardo numbers, starting at L(0).
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
 
1st 25 Leonardo numbers, specifying 0 and 1 for L(0) and L(1), and 0 for the add number:
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|AWK}}==
299

edits