I got stucked a little with this question. would appreciate your help. the question is "find a recursive relation that counts how many sequences of order n above ${1,2,3,4,5,6,7}$ that don't contain odd couples of numbers (for example it can't contain 11 or 13 or 15 or 17 or 31 or 33 etc...)"
so what I did is the following:
- for a sequence beginning with 2 or 4 or 6 there's no limit so another $a_{n-1}$ options
- for a sequence beginning with 1 it can't get 1 or 3 or 5 or 7 afterwards. so let's look at the total number of legal options $a_{n-1}$ and subtract the legal sequences beginning with 1 or 3 or 5 or 7 = $4*a_{n-2}$. so in total we get $a_{n-1}-4*a_{n-2}$ options in total.
- the same goes for a sequence beginning with 3 or 5 or 7 as for a sequence beginning with 1 described above.
thus, if we sum all mentioned we get $a_n=7a_{n-1}-16a_{n-2}$. but I found that the correct answer would be $a_n=3a_{n-1}+12a_{n-2}$ from some reason. what am I doing wrong? would appreciate your advice,
Let $E_n$ denote the number of good sequences that end in an even number, $O_n$ the number that end in an odd number, and $a_n$ the total (so $a_n$ is the answer you seek).
We can always append an even number so $$E_{n}=3\times a_{n-1}$$ We can only append an odd number to a sequence that ends in an even number, so $$O_{n}=4\times E_{n-1}=12\times a_{n-2}$$ Thus $$a_n=E_n+O_n=3a_{n-1}+12a_{n-2}$$