Answer the question
In order to leave comments, you need to log in
Which combinatorics formula to use?
Hello. Help with the formula, I can’t figure it out: the number of numbers from a number, for example, 100101, zeros cannot be in front
I would be very grateful
Answer the question
In order to leave comments, you need to log in
Count the number of zeros and ones in the original number. Let it be N0 and N1.
If zeros cannot be in front, then only one can be in front. If N1 > 0, decrease N1 by 1, otherwise there are no solutions.
Now we need to arrange N0 zeros and N1 - 1 ones in all possible ways. They will be (N0 + N1 - 1)!
. But since all zeros and all ones are the same, there will be N0! * (N1 - 1)!
several times fewer different combinations, (N0 + N1 - 1)! / (N0! * (N1 - 1)!)
. These are permutations with repetitions . For the number 100101 the result is 10:
100011, 100101, 100110, 101001, 101010, 101100, 110001, 110010, 110100, 111000.
As many as you want if the number of digits is not limited.
If there is such a restriction, then 2 to the power of k, where k is the number of remaining digits.
This is if we are talking about a binary number system, of course.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question