This is a recursive function for seq(n-1) - (n-2) def seq(n, x, y): if n == 0: return x elif n == 1: return y else: return seq(n-1, x, y) - seq(n-2, x, y) print(seq(2,5,8)) Both I ChatGPT agree but not people who asked the question.