The intimidated chickens
Consider $n$ chickens sitting in a row. Each chicken is oriented to look either to the left or to the right. Chicken $i$
is intimidated iff chickens $i-1$ and $i+1$ are both looking at it. A good orientation of the chickens is one
in which no chicken is intimidated. In the following figure, the second chicken is intimidated.
Once this is known, it becomes clear that an algorithm to generate all good permutations is not hard to conceive. We can ask to design such an algorithm with optimal running time, thus moving from experimental (inefficient) code, to math, to optimal algorithm.
For further endeavors, the number of good orientations of $n$ chickens, call it $g_n$, can be described by a non-trivial recurrence involving $g_{n-1}$, $g_{n-2}$, $g_{n-3}$, and $g_{n-4}$. Using wolframalpha, we can explore this recurrence and its closed-form solution, which may reveal an expression different from the one obtained initially. This in turn provides an opportunity to explore mathematical proofs and discover an identity. In addition, the sequence $g_n$ can be related to many combinatorial problems in the literature. By discovering candidate problems using oeis, we will gain a deeper understanding of the combinatorial nature of these problems and establish how/why they are related.