Skip to content

Instantly share code, notes, and snippets.

@omalley
Created June 27, 2017 17:13
Show Gist options
  • Select an option

  • Save omalley/03cf5bd2cc9b15c6344e6ff3937ee4aa to your computer and use it in GitHub Desktop.

Select an option

Save omalley/03cf5bd2cc9b15c6344e6ff3937ee4aa to your computer and use it in GitHub Desktop.

Revisions

  1. omalley created this gist Jun 27, 2017.
    15 changes: 15 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    >>> def fib(n):
    ... last = 0
    ... current = 1
    ... for i in range(n):
    ... (last, current) = (current, last + current)
    ... return current
    ...
    >>> fib(3)
    3
    >>> fib(100)
    573147844013817084101
    >>> fib(30)
    1346269
    >>> fib(1000)
    70330367711422815821835254877183549770181269836358732742604905087154537118196933579742249494562611733487750449241765991088186363265450223647106012053374121273867339111198139373125598767690091902245245323403501