how to populate a list and check if new item already belongs to the list

The questions asks me to consider a sequence of integers given by x_0 =0 x_n = { x_(n-1) -n or if this value is in sequence already x_(n-1)+n } The first few terms are: 0,1,3,6

this is the code I've done so far it's not working I'm not sure if I've just gone down the wrong path to solve this completely any help would be appreciated

      import numpy as np
      import colections
      n=0
      for n in range(100):
              n += 1
              x=n-n
              if isinstance([],collections.sequence)=true:
              x=n+n         

sorry about the bad formatting of the question wasn't sure how to write subscripts on this

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum