2023-07-01 11:58:00 -04:00
|
|
|
integer Fibonacci(integer n) {
|
2026-04-30 12:34:36 -04:00
|
|
|
if(n<2) {
|
|
|
|
|
return n;
|
|
|
|
|
} else {
|
|
|
|
|
return Fibonacci(n-1)+Fibonacci(n-2);
|
|
|
|
|
}
|
2023-07-01 11:58:00 -04:00
|
|
|
}
|
|
|
|
|
default {
|
2026-04-30 12:34:36 -04:00
|
|
|
state_entry() {
|
|
|
|
|
integer x = 0;
|
|
|
|
|
for(x=0 ; x<35 ; x++) {
|
|
|
|
|
llOwnerSay("Fibonacci("+(string)x+")="+(string)Fibonacci(x));
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-07-01 11:58:00 -04:00
|
|
|
}
|