Question: Bob makes a list of numbers, where each number is 1, 2, or 3, and the number 2 appears an even number of times. How many different lists could Bob have made?
I tried looking for patterns, but so far I haven't had much luck. Help would be appreciated!
The wording is kind of confusing but shouldn't he be able to make infinite number of combinations if he can just list them over and over?
That is correct. However, the question is asking in terms of n.
So, for example, if n = 1, then there are 2 options: 1 or 3
If n = 2, then there are 5 options: (11), (22), (33), (13), or (31)
We need to find some sort of recursion that works for any number n I think but I'm not sure how.
After some messing around, I got this:
\(\displaystyle \sum_{k=0}^{\operatorname{floor}\left(\frac{n}{2}\right)+1}\operatorname{nCr}\left(n,\ 2k\right)\cdot2^{\left(n-2k\right)}\)
Basically, the floor(n/2)+1 calculates the number of possible twos given n. For example, if n is 3, the number of possible twos is floor(3/2)+1=2 (which is correct, since there could be either 0 or 2 twos)
The nCr(n, 2k) basically chooses the spots for the twos to be in.
Lastly, the 2^(n-2k) fills the rest of the remaining spots with either 3s or 1s.
It does not look very neat, but I don't really have the effort and determination to reduce it though lol