Ways to Choose Three Adjacent Elements from a Set In essence, how many unique ways can I choose a subset of N people such that there exist 3 people in the subset who are adjacent in the original set. 
e.g. N = 4
Lets label the people {1,2,3,4}
I can choose {1,2,3} , {2,3,4} , { 1,2,3,4} making a total of 3 ways.
Here I assume that {1,2,3} = {3,2,1} etc. are the same
Is there any general formula I can derive for calculating this? 
 A: Let us call the number of ways of choosing a subset of N people such that there exist 3 people in the subset who are adjacent in the original set as $a_n$. Call such subsets good.
Let's try to find a recurrence for $a_n$. 
Now, let us take any such subset of $N-1$ people, and consider that set with $N$ in it and not in it. Clearly both are distinct good subsets. So, this amounts to $2 a_{n-1}$ ways.
So, the elements not yet considered have $N$ in the triplet, and in fact the triplet $N-2, N-1,N$ should be the only one inside the subset, otherwise it has been calculated before. So, this amounts to $2^{n-4} - a_{n-4}$ ways, as we need the number of subsets of $N-4$ people not having any such triplet (Note that the element $N-3$ cannot be in the set).
So, we get the recurrence as $$a_{n} = 2a_{n-1} + 2^{n-4} - a_{n-4}$$ with initial conditions as $a_1=a_2=0, a_3=1, a_4=3$.
As regards to a general formula, the use of OEIS leads to this which tells us that the generating function is $$G(x) = \frac{x^3}{(1-2x)(1-x-x^2-x^3)}$$ and also gives a nicer looking recurrence: $$a_n = 3a_{n-1} - a_{n-2} - a_{n-3} - 2a_{n-4}$$
