Originally Posted by

**xxxGxxx** HEY GUYS, please help me out,

i am trying to do some programming and im stuck now. i need to implement an iterative funtion in python so i can generate numbers in the fibonacci sequence. below is the the coding for it.

fib(0) = 1

fib(1) = 1

fib(n) = fib(n − 1) + fib(n − 2)

please can someone help me on how to implement it.

appreciate it if anyone could,

Thanks.

G X

Well I don't know Python but here it is in Euler:

Code:

function fibb(n)
if n==1
return 1;
elseif n==0
return 1
endif
rv=fibb(n-1)+fibb(n-2);
return rv
endfunction

and some example calls:

Code:

>
>fibb(1)
1
>fibb(0)
1
>fibb(2)
2
>fibb(3)
3
>fibb(4)
5
>fibb(15)
987
>

RonL