Skip to content

Instantly share code, notes, and snippets.

@amandaroos
Created April 30, 2020 21:09
Show Gist options
  • Save amandaroos/e4fbf5752ec794aeb96da405f0b215b8 to your computer and use it in GitHub Desktop.
Save amandaroos/e4fbf5752ec794aeb96da405f0b215b8 to your computer and use it in GitHub Desktop.
Non-recursive way of solving Fibonacci rabbits: http://rosalind.info/problems/fib/
#n is generations, m is pairs of rabbits born per litter
#b is pairs of baby bunnies, B is pairs of adult bunnies
def get_rabbits(n, m):
b, B = 1, 0
for i in range(1, n):
b, B = B * m, B + b
return B + b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment