The sequence \((1,3,5,2,1,2,1)\) has the property that every integer in the sequence is a divisor of the sum of the integers adjacent to it. That is, \(1\) is a divisor of \(3\), \(3\) is a divisor of \(1+5=6\), \(5\) is a divisor of \(3+2=5\), and so on.
For \(n\geq 3\), the sequence \((a_1,a_2,a_3,\dots, a_n)\) of positive integers is called a splendid sequence of length \(n\) if it satisfies conditions S1, S2, and S3 found below.
S1. \(a_1\) is a divisor of \(a_2\) and \(a_n\) is a divisor of \(a_{n-1}\).
S2. \(a_i\) is a divisor of \(a_{i-1}+a_{i+1}\) for each \(i\) from \(2\) through \(n-1\) inclusive.
S3. There is no prime number that is a divisor of every integer in the sequence.
For example, \((1,3,5,2,1,2,1)\) is a splendid sequence because it satisfies S1, S2, and S3. The sequence \((2,4,6,2)\) satisfies S1 and S2, but it is not a splendid sequence because it fails S3 since \(2\) is a divisor of every integer in the sequence.
For \(n=2\), \((a_1,a_2)\) is a splendid sequence of length \(2\) if it satisfies S1 and S3. Mostly for notational convenience, we also define a splendid sequence of length \(1\) to be the "sequence" \((1)\). That is, the only splendid sequence of length \(1\) consists of a single integer equal to \(1\).
Show that there is only one splendid sequence of length \(2\).
Show that there is at least one splendid sequence of every possible length \(n\geq 1\).
Suppose \((a_1,a_2,a_3,\dots,a_n)\) is a splendid sequence of length \(n\geq 2\). Show that for every integer \(i\) with \(1\leq i\leq n-1\) there is a positive integer \(c\) so that \((a_1,a_2,\dots,a_i,c,a_{i+1},\dots,a_n)\) is a splendid sequence of length \(n+1\).
Suppose \((a_1,a_2,a_3,\dots,a_n)\) is a splendid sequence of length \(n\). Show that \(a_1=a_n=1\).
For each \(n\geq 1\), show that there are only finitely many splendid sequences of length \(n\).
Find a closed form for the number of splendid sequences of length \(n\). Your answer should be an expression in terms of \(n\).
Note: In part (f), we are asking you to find a closed form for the number of splendid sequences, the existence of which immediately implies that there are only finitely many. Hence, one way to answer part (e) is to answer part (f). With that said, we decided to include part (e) because it can be done without part (f) and (at least as far as we can tell) it is quite a bit easier than part (f). Part (f) is very challenging, so the hint will have more detail than usual.