Fibonacci n-step number sequences: Difference between revisions
m
→{{header|Ruby}}: typo lucus -> lucas
(→{{header|Ruby}}: polished code somewhat) |
m (→{{header|Ruby}}: typo lucus -> lucas) |
||
Line 3,911:
end
naccis = {
fibonacci: [1,1],
tribonacci: [1,1,2],
Line 3,924:
naccis.each {|name, seq| puts "%12s : %p" % [name, anynacci(seq, 15)]}</lang>
{{out}}
<lang ruby>
fibonacci : [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610]
tribonacci : [1, 1, 2, 4, 7, 13, 24, 44, 81, 149, 274, 504, 927, 1705, 3136]
|