Write Python code to find if ALL the numbers in a given list of integers are PART of the series defined by the following. f(0) = 0 f(1) = 1 f(n) = 3*f(n-1) - 2*f(n-2) for all n > 1. def is_part_of_series(lst) code example
Example: fibonacci sequence python
# WARNING: this program assumes the
# fibonacci sequence starts at 1
def fib(num):
"""return the number at index num in the fibonacci sequence"""
if num <= 2:
return 1
return fib(num - 1) + fib(num - 2)
print(fib(6)) # 8