def fibonacci(termo)
return [] if termo == 0
return [0] if termo == 1
return [0, 1] if termo == 2
lista = fibonacci(termo - 1)
lista << lista[-2] + lista[-1]
return lista
end
print fibonacci(10)
#https://pt.stackoverflow.com/q/336649/101
ZGVmIGZpYm9uYWNjaSh0ZXJtbykKICAgIHJldHVybiBbXSBpZiB0ZXJtbyA9PSAwCiAgICByZXR1cm4gWzBdIGlmIHRlcm1vID09IDEKICAgIHJldHVybiBbMCwgMV0gaWYgdGVybW8gPT0gMiAKICAgIGxpc3RhID0gZmlib25hY2NpKHRlcm1vIC0gMSkgCiAgICBsaXN0YSA8PCBsaXN0YVstMl0gKyBsaXN0YVstMV0KICAgIHJldHVybiBsaXN0YQplbmQKcHJpbnQgZmlib25hY2NpKDEwKQoKI2h0dHBzOi8vcHQuc3RhY2tvdmVyZmxvdy5jb20vcS8zMzY2NDkvMTAx
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34]