Fibonacci sequence: Difference between revisions
Content added Content deleted
(adding sas) |
(→{{header|Racket}}: removed: there are more scheme solutions below) |
||
Line 3,153: | Line 3,153: | ||
<lang R>print.table(lapply(0:20, recfibo)) |
<lang R>print.table(lapply(0:20, recfibo)) |
||
print.table(lapply(0:20, iterfibo))</lang> |
print.table(lapply(0:20, iterfibo))</lang> |
||
=={{header|Racket}}== |
|||
Recursive |
|||
<lang Racket>(define (fib n) |
|||
(if (< n 2) |
|||
1 |
|||
(+ (fib (- n 1)) (fib (- n 2)))))</lang> |
|||
=={{header|REALbasic}}== |
=={{header|REALbasic}}== |
||
Pass n to this function where n is the desired number of iterations. This example uses the UInt64 datatype which is as unsigned 64 bit integer. As such, it overflows after the 92nd iteration. |
Pass n to this function where n is the desired number of iterations. This example uses the UInt64 datatype which is as unsigned 64 bit integer. As such, it overflows after the 92nd iteration. |