Ternary Sequence of 1,3, 5

155 Views Asked by At

Find a recurrence relation for the number of the sequences of 1s, 3s, and 5s whose terms sum to n with the condition of no subsequence of 135.

My approach.
Without condition(no subsequence of 135), it is $$ a_n = a_{n-1} + a_{n-3} + a_{n-5} $$

Since 135's sum is 9, $$ a_n = a_{n-1} + a_{n-3} + a_{n-5} - a_{n-9} $$

If I miss anything, please let me know. Thanks!