We have C(5,1) choices for the first nine digits and C(3,1) choices for the last. By the product rule, the answer is 3*59 = 5,859,375.
There are C(5,2)*(2n - 2) codewords with two different digits, and C(5,3)*(3n-3*2n+3) codewords with three different digits, for a total of 10*(3n - 2*2n + 1)
The left side counts the number of ways of choosing two numbers from [2n]. The right side counts the number of ways of either choosing two numbers from {1,2,...,n} or {n+1,n+2,...,2n}, or one number from each set. These describe an equivalent process, so the number of ways is equal.
C(2n,n) + C(2n,n-1) = C(2n+1,n) = C(2n+2,n+1)/2.
One box must have sixteen balls, the other two have eight together. There are C(3,1) ways of choosing the first box, C(24,16) ways of choosing the balls that go into it, and C(2,1)8 ways of choosing which box the remaining balls go into. The answer is therefore C(3,1)*C(24,16)*C(2,1)8.
C(16+3-1,16) - C(5+3-1,5) = 153 - 21 = 132.