Skip to content

Instantly share code, notes, and snippets.

@asvnpr
Last active February 1, 2017 04:21
Show Gist options
  • Save asvnpr/08a29b6e18c3f154f152014a4fb76dbb to your computer and use it in GitHub Desktop.
Save asvnpr/08a29b6e18c3f154f152014a4fb76dbb to your computer and use it in GitHub Desktop.
rabbits reproduce and stuff
#! /usr/bin/env python3
#from http://rosalind.info/problems/fib/
def rabi(n,m):
a = [1,1,2]
if (n < 4):
return a[n-1]
else:
for i in range(2, n):
a.append(a[i-1] - a[i-(m-1)])
print(a)
return a[-1]
inp = input()
n = int(inp.split()[0])
= int(inp.split()[1])
print(rabi(n,m))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment