
How many n-digit decimal integers have all digits 1, 2 or 3. How many also contain each of 1, 2, 3 at least once?
Solution
3 choices for each digit, so 3n in all.
We must exclude the 2n with all digits 1 or 2, and the 2n with all digits 2 or 3, and the 2n with all digits 1 or 3. But then we exclude twice those with all digits 1, all digits 2 and all digits 3. Hence 3n - 3·2n + 3.
![]()
© John Scholes
jscholes@kalva.demon.co.uk
29 Oct 2003
Last corrected/updated 29 Oct 03