Padovan n-step number sequences: Difference between revisions

Added 11l
(Added 11l)
Line 48:
# Use this to print and show here at least the first <code>t=15</code> values of the first <code>2..8</code> <math>n</math>-step sequences.<br> (The [https://oeis.org OEIS] column in the table above should be omitted).
<br><br>
 
=={{header|11l}}==
{{trans|Nim}}
 
<lang 11l>F rn(n, k) -> [Int]
assert(k >= 2)
V result = I n == 2 {[1, 1, 1]} E rn(n - 1, n + 1)
L result.len != k
result.append(sum(result[(len)-n-1 .< (len)-1]))
R result
 
L(n) 2..8
print(n‘: ’rn(n, 15).map(it -> ‘#3’.format(it)).join(‘ ’))</lang>
 
{{out}}
<pre>
2: 1 1 1 2 2 3 4 5 7 9 12 16 21 28 37
3: 1 1 1 2 3 4 6 9 13 19 28 41 60 88 129
4: 1 1 1 2 3 5 7 11 17 26 40 61 94 144 221
5: 1 1 1 2 3 5 8 12 19 30 47 74 116 182 286
6: 1 1 1 2 3 5 8 13 20 32 51 81 129 205 326
7: 1 1 1 2 3 5 8 13 21 33 53 85 136 218 349
8: 1 1 1 2 3 5 8 13 21 34 54 87 140 225 362
</pre>
 
=={{header|ALGOL 68}}==
1,481

edits