Last active
February 1, 2017 04:21
-
-
Save asvnpr/08a29b6e18c3f154f152014a4fb76dbb to your computer and use it in GitHub Desktop.
rabbits reproduce and stuff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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