Much cooler than your run-of-the-mill Fibonacci numbers, the Triple Shiftian are so defined: `T[n] = 4 * T[n-1] - 5 * T[n-2] + 3 * T[n-3]`.

You are asked to create a function which accept a base with the first 3 numbers and then returns the nth element.
```python
triple_shiftian([1,1,1],25) == 1219856746
triple_shiftian([1,2,3],25) == 2052198929
triple_shiftian([6,7,2],25) == -2575238999
triple_shiftian([3,2,1],35) == 23471258855679
triple_shiftian([1,9,2],2) ==  2
```
*Note: this is meant to be an interview quiz, so the description is scarce in detail on purpose*

Special thanks to the [first person I met in person here in London just because of CW](http://www.codewars.com/users/webtechalex) and that assisted me during the creation of this kata ;)

Source: codewars | Difficulty: EASY
Tags: Number theory

Fundamentals

Starter code: def triple_shiftian(base,n):
	

Solutions:
def triple_shiftian(T, n):
	for i in range(3, n + 1):
		T.append(4 * T[i - 1] - 5 * T[i - 2] + 3 * T[i - 3])
	return T[n]


def triple_shiftian(base, n):
	(a, b, c) = base
	for _ in range(n):
		(a, b, c) = (b, c, 4 * c - 5 * b + 3 * a)
	return a


def triple_shiftian(base, n):
	(a, b, c) = base
	i = 0
	while i < n:
		(a, b, c) = (b, c, 4 * c - 5 * b + 3 * a)
		i += 1
	return a


triple_shiftian = lambda base, n: base[n] if n < len(base) else triple_shiftian(base + [4 * base[-1] - 5 * base[-2] + 3 * base[-3]], n)


def triple_shiftian(base, n):
	while n:
		(base[0], base[1], base[2]) = (base[1], base[2], 4 * base[2] - 5 * base[1] + 3 * base[0])
		n -= 1
	return base[0]


def triple_shiftian(base, n):
	num = [0] * (n + 1) if n > 3 else [0, 0, 0]
	(num[0], num[1], num[2]) = base
	i = 3
	while i <= n:
		num[i] = 4 * num[i - 1] - 5 * num[i - 2] + 3 * num[i - 3]
		i += 1
	return num[n]