For an integer n≥3 consider the sets
Sn={(x1,x2,…,xn):∀ixi∈{0,1,2}}
An={(x1,x2,…,xn)∈Sn:∀i≤n−2∣{xi,xi+1,xi+2}∣=1}
and
Bn={(x1,x2,…,xn)∈Sn:∀i≤n−1(xi=xi+1⇒xi=0)}.
Prove that ∣An+1∣=3⋅∣Bn∣.
(∣A∣ denotes the number of elements of the set A.)