<s>[INST] Help needed to solve combinatorics problem. I have been revisiting my old probability courses and I found a problem, which I can't figure out how to solve or at least what I get differs from the answer in the book. 
The problem reads as follows:
Given 8 balls i.e. 5 white 1 black, 1 blue and 1 red, find how many sequences of 6 objects can be formed (ordering matters!). 
Hint1:
Only permutations and permutations with repetition might be used. This is taken from a German textbook (I have translated it to my best), and the question comes at the end of the chapter on permutations. Notice that variations $\frac{n!}{(n-k)!}$ and combinations $\frac{n!}{(n-k)!k!}$ are not covered yet.  
Hint2: 
The answer according to the textbook is 178. 
Please note, that all the answers given below use the combination formula to get the answer and they all differ from 178, which is supposed to be the right answer.  
 [/INST] Use exponential generating functions. The white balls give:
$$
1 + \frac{z}{1!} + \frac{z^2}{2!} + \frac{z^3}{3!} + \frac{z^4}{4!} + \frac{z^5}{5!}
$$
Each of the other colors gives:
$$
1 + \frac{z}{1!}
$$
In all, we want:
$$
6! [z^6] \left( 1 + \frac{z}{1!} + \frac{z^2}{2!} + \frac{z^3}{3!} + \frac{z^4}{4!} + \frac{z^5}{5!} \right) \cdot ( 1 + z)^3 
$$
My tame symbolic algebra system (maxima) tells me this is 228.
Alternatively, it can be computed by hand (ellipses are terms that don't affect the result):
$\begin{align}
6! [z^6] \left( e^z - \frac{z^6}{6!} - \dots \right) \cdot (1 + z)^3
  &= 6! \left( [z^6] e^z (1 + 3 z + 3 z^2 + z^3) - [z^6] \frac{z^6}{6!} \cdot (1 + \dots) \right) \\
  &= 6! \left(\frac{1}{6!} 
                + 3 \cdot \frac{1}{5!}
                + 3 \cdot \frac{1}{4!}
                + \frac{1}{3!}
                - \frac{1}{6!}
        \right) \\
  &= 228
\end{align}$
</s>