# Calculate The Number of Possibale Binary Combinations “When Occurance Count of 1 is Given ”?

I know how to calculate possible combinations of binary by the rule (2^n) where n is the number of digits , but how to calculate the number of possible binary combinations with specific count of 1,for example: the number of combinations when digits n = 8 ,and 1 count c = 1 is 8 different combinations as follows :

00000001,00000010,00000100,00001000,00010000,00100000,01000000,10000000

can someone help me find the general formula for this ?

## 2 Answers

The number you are after is the binomial coefficient $$\binom{n}{c}=\frac{n!}{c!(n-c)!}$$ where $n!=1\times2\times3\times\cdots\times n$ is the factorial of $n$.

• oh ! how did I miss that thanks ! – user2548447 Jun 8 '17 at 4:25

Just to be sure, you're asking for a formula for the number of ways to take $n$ possible bits and set $k$ of them to 1? Then the answer is the binomial coefficient, or "choose function", ${n \choose k} = \frac{n!}{k!(n-k)!}$.