Skip to content

Instantly share code, notes, and snippets.

@amandaroos
Created April 30, 2020 21:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amandaroos/d6695efc3cd2934eae3e13bd82905116 to your computer and use it in GitHub Desktop.
Save amandaroos/d6695efc3cd2934eae3e13bd82905116 to your computer and use it in GitHub Desktop.
#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):
if n == 1:
return 1, 0
else:
b, B = get_rabbits(n-1, m)
return(B*m, B + b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment