Because it’s a cyclic pattern you could use a cyclic function for finding the nth term, for example, sine or cosine.
But it’s easier to use the remainder of n/3. If the remainder is 0, the term is 2, if the remainder is 1, the term is -2 and if the remainder is 2, the term is 0. So 100/3 has a remainder 1, so the term is -2.
(The formula 2(n+1-3[(n+2)/3]), where [] means the integer part of the mixed number in the brackets, can be used. For example, when n=100 the formula becomes 2(101-3[102/3])=2(101-3×34)=2(101-102)=2(-1)=-2.)