Fn = Fn-1 + Fn-2 - Fn-(m+1)
To calculate the number of rabbits after 96 months, when the rabbits are dying after 17 months, I wrote the following program:
n = 96
m = 17
bunnies = [1, 1]
months = 2
while months < n:
if months < m:
bunnies.append(bunnies[-2] + bunnies[-1])
elif months == m or count == m + 1:
bunnies.append(bunnies[-2] + bunnies[-1] - 1)
else:
bunnies.append(bunnies[-2] + bunnies[-1] - bunnies[-(
m + 1)])
months += 1
print(bunnies[-1])
So, care to take a guess what the result after 96 months was? 51159459138167757395. Pairs...