Problem Archive

An infant's toy consists of $n$ cups, labelled $C_1,\dots,C_n$ in increasing order of size.

0907_four_cups.png

The cups may be stacked in various combinations and orientations to form towers. The cups are shaped such that the following means of stacking are possible:

Define $S(n)$ to be the number of ways to build a single tower using all $n$ cups according to the above rules.
You are given $S(4)=12$, $S(8)=58$, and $S(20)=5560$.

Find $S(10^7)$, giving your answer modulo $1\,000\,000\,007$.

Solution
No solution yet. Write yours at solutions/s907.md.
Problems sourced from Project Euler · Non-commercial & educational use only · CC BY-NC-SA 4.0