Recurrence relation and combinatoric question

85 Views Asked by At

Find a recurrence relation for the number of sequences of 1s, 3s, and 5s whose terms sum to $n$.

In this question, I know that the relation is $a_n=a_{n-1}+a_{n-3}+a_{n-5}$. However, when going through concrete examples, I don't understand why this is the relation.

$a_1=1$ since the only sequence of 1s, 3s, and 5s whose sum is 1 is $1$

$a_2=1$ where this sequence would be $1+1$

$a_3=2\implies$ $3$ and $1+1+1$

The next one is where I start to get confused. Based on the construction of $a_n$, the remaining sequence after choosing the first value determines the number of ways to determine the sequence. So, $a_4$ would be constructed by choosing 3 first, which means the sequence is $3+1$, or choosing 1 first. When you choose 1, the remaining numbers have to add up to 3, so in theory, this can be constructed in $a_3$ ways, but wouldn't $1+3$ be considered the same sequence as $3+1$?