Write an python function that gets n and returns the nth value in the Pell sequence. Pell
Fantastic news! We've Found the answer you've been seeking!
Question:
Write an python function that gets n and returns the nth value in the Pell sequence. Pell sequence is defined by
P(n) = 2*P(n-1) + P(n-2) while P(0) = 0 and P(1) = 1. Use your code to generate and provide the first 10 values of Pell sequence.
def pell(n):
Run an analysis of the function developed in above and find its T(n) and big O performance. Is finding the nth element of Pell sequence faster than bubble sort? Is it faster than finding the nth element of the Fibonacci series?
Related Book For
Microeconomics An Intuitive Approach with Calculus
ISBN: 978-0538453257
1st edition
Authors: Thomas Nechyba
Posted Date: