[Math] How many 19-bit strings can be generated from having an even number of ones

discrete mathematicspermutations

So essentially how many 19-bit strings can you make with 2 1's or 4 1's or …. or 18 1's?

I know the # of 19-bit strings that can be produced with 2 1's would be 19!/17!2! and the number of 19-bit strings that can be produced with 4 1's would be 19!/15!4! ….. up until 19!/18! in the case where there are 18 1's. The thing I don't understand is how much overlap occurs.

I know this problem has to do with inclusion-exclusion principle, I am just confused on how to calculate the intersection of every single possible outcome.

Best Answer

make any string with the fist 18 digits. The last digit is forced to be a 1 or a 0, based on the number of 1s in the first 18.