Write a python function to generate Lucas Numbers (2, 1, 3, 4, 7, 11, 18...)


Topic: Write a python function to generate Lucas Numbers (2, 1, 3, 4, 7, 11, 18...)

Solution

def lucas_numbers(n):
    first, second = 2,1
    for _ in range(n):
        first, second = second, first+second
    return first
            



List all Python Programs