lucas series Algorithm

The Lucas numbers or Lucas series are an integer sequence named after the mathematician François Édouard Anatole Lucas (1842–91), who study both that sequence and the closely associated Fibonacci numbers. The sequence also has a variety of relationships with the Fibonacci numbers, like the fact that adding any two Fibonacci numbers two terms apart in the Fibonacci sequence outcomes in the Lucas number in between.
# Lucas Sequence Using Recursion


def recur_luc(n):
    """
    >>> recur_luc(1)
    1
    >>> recur_luc(0)
    2
    """
    if n == 1:
        return n
    if n == 0:
        return 2
    return recur_luc(n - 1) + recur_luc(n - 2)


if __name__ == "__main__":
    limit = int(input("How many terms to include in Lucas series:"))
    print("Lucas series:")
    for i in range(limit):
        print(recur_luc(i))

LANGUAGE:

DARK MODE: