Numerical answer
Find the number of -digit strings formed using only the digits , in which each of the three digits appears at least once and the sum of all the digits is divisible by .
Show answer and solution
Answer: 602
Let be the numbers of s, s, s, with and each at least . The digit sum is , so we need . The admissible triples are , contributing arrangements respectively, which total . As a cross-check, a complete brute-force enumeration of all strings, keeping those that use all three digits with digit sum divisible by , returns exactly strings. The answer is . The congruence argument is shorter than a roots-of-unity filter, and the surjectivity condition is built in because every composition has each part at least one. A common slip is to forget that the multinomial coefficient must be used for arrangements, not just the number of compositions, which would give only five.
Saved on this device. Sign in or create a free account to keep it on every device.