In his publication Liber Abaci Leonardo Bonacci, aka Fibonacci, posed a problem involving a population of idealized rabbits. These rabbits bred at a fixed rate, matured over the course of one month, had unlimited resources, and were immortal.

Beginning with one immature pair of these idealized rabbits that produce b pairs of offspring at the end of each month. Create a function that determines the number of pair of mature rabbits after n months.

To illustrate the problem, consider the following example:

```python
fib_rabbits(5, 3) returns 19
```




Month
Immature Pairs
Adult Pairs




0
1
0


1
0
1


2
3
1


3
3
4


4
12
7


5
21
19



                                
        
Hint: any Fibonacci number can be computed using the following equation Fn = F(n-1) + F(n-2)

Difficulty: introductory

Starter code:

def fib_rabbits(n, b):
	

Solutions:
def fib_rabbits(n, b):
    (i, a) = (1, 0)
    for m in range(n):
        (i, a) = (a * b, a + i)
    return a


def fib_rabbits(n, b):
    x, y = 0, 1
    for _ in range(n):
        x, y = y, x * b + y
    return x

def fib_rabbits(n, m):
    a,b = 0,1
    for i in range(n):
        a,b = b, b+a*m
    return a

def fib_rabbits(end, factor):
    immatures, adults = 1, 0
    for month in range(end):
        immatures, adults = (factor * adults), (adults + immatures)
    return adults

def fib_rabbits(n, b):
    f = [0, 1]
    for _ in range(n - 1): f.append(f[-1] + b * f[-2])
    return f[n]

def fib_rabbits(n, b):
    obj = {'IP':1,'AP':0}
    for month in range(1, n+1):
        cur = obj['IP']
        obj['IP'] = b * obj['AP'] 
        obj['AP'] += cur
        
    return obj['AP']

def fib_rabbits(n, b):
    if n == 0:
        return 0
    x, y = b, 1
    for _ in range(n-2):
        x, y = y*b, x+y
    return y

def fib_rabbits(n, b):
    table = [0 if i!=1 else 1 for i in range(0, n+1)]
    
    for i in range (2, n+1):
        table[i] = (table[i-1]+ table[i-2]*b)
    
    return table[n]

def fib_rabbits(n, b):
    if n < 2:
        return n
    ans = [0, 1]
    for i in range(2, n+1):
        ans[0], ans[1] = ans[-1]*b, sum(ans)
    return ans[-1]

def fib_rabbits(n, b):
    f = [0]*(n+10)
    f[1] = 1
    for i in range(2 , n+10):
        f[i] = f[i-1] + (b * f[i-2])
    return f[n]