Suppose I have a multiset of 10 digits, for example S = { 1, 1, 2, 2, 2, 3, 3, 3, 8, 9 } . Is there any method other than brute force to find the number of different permutations of elements from S such that when the permutation is considered as a ten-digit integer, it is divided by a certain number n ? n will range from 1 to 10000 .
For instance:
if S = { 1, 2, 3, 4, 6, 1, 2, 3, 4, 6 } and n = 10 , the result is 0 (since no permutation of these 10 digits will ever give a number divisible by 10)
if S = { 1, 1, 3, 3, 5, 5, 7, 7, 9, 2} and n = 2 , the result is 9! / 2^4 9! / 2^4 (since in the end we must have 2 , there is a 9! Way to rearrange other elements, but there are four pairs of identical elements)
source share