0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ...
function _fib(number) {
if (number === 0 || number === 1) {
return number;
} else {
return _fib(number - 1) + _fib(number - 2)
}
}
//x is the index number in the fibonnacci sequence.
//The function will return that index's fibonacci value
function fib(x) {
let a = 0;
let b = 1;
for (var i = 0; i < x-1; i++) {
let c = b;
b += a;
a = c;
}
return b;
}
function myFib(n) {
if (isNaN(n) || Math.floor(n) !== n)
return "Not an integer value!";
if (n === 0 || n === 1)
return 3;
else
return myFib(n - 1) + myFib(n - 2);
}
console.log(myFib(5));
nterms = int(input())
x, y, z = 1, 1, 0
if nterms == 1:
print(x)
else:
while z < nterms:
print(x, end=" ")
nth = x + y
x = y
y = nth
z += 1