Suppose order does not matter, then combinations will consist of 0 to 3 of the singleton colors, and 5 to 8 that are some combination of red, white or blue. This implies that we shall formulate the answer as the sum from k=0 to k=3 of:
N=(Number of ways to pick k of the single colors)*(number of ways to pick 8-k balls from red, white pr blue)
The first factor is C(3,k), let's call the second factor A(8-k), where A(n) is the number of combinations or red, white or blue when n balls are selected. Given that we want to express A(n) as a formula in terms of n, let's say there are r red balls in a combination (0≤r≤n). Then there are (n-r) balls that are either white or blue that have been left over. Thus, the number of white balls must be integer from 0 to (n-r), for the universe of (n-r+1) possibilities. Hence, the rest are blue in exactly one way, so A(n) is the sum over r=0 to n:
A(n)=∑(1+n-r)
A(n)=(n+1)(n+1)-n(n+1)2
=(n+1)(2n+2-n)/2
=(n+1)(n+2)/2
thus
A(5)=6*7/2=21
A(6)=7*8/2=28
A(7)=8*9/2=36
A(8)=9*10/2=45
The total will give:
N=C(3,0)*A(8)+C(3,1)*A(7)+C(3,2)*A(6)+C(3,3)*A(5)
N=1*45+3*36+3*28+1*21=258
The answer is 258