Skip to content

Instantly share code, notes, and snippets.

@devnoo
Created November 27, 2011 08:59
Show Gist options
  • Save devnoo/1397268 to your computer and use it in GitHub Desktop.
Save devnoo/1397268 to your computer and use it in GitHub Desktop.
io-fibonaci-loop
fib := method(n ,
if ((n == 1) or (n==2), return 1)
j := 1
k := 1
for(i, 3, n,
next := j + k
j = k
k = next
)
return next
)
for (i, 1, 25, fib(i) println)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment