Open Side Menu Go to the Top
Register
permutation or combination or neither ? permutation or combination or neither ?

04-07-2015 , 08:00 AM
Given, a 16 bit unsigned integer that contains eight 0 bits, eight 1 bits, how many numeric combinations are there ?

Programmatically I can do it with bit shifting, indexing with where to start the bit shifts.

But is there a combination / permutation / other formula for this particular sequence ?
permutation or combination or neither ? Quote
04-07-2015 , 08:28 AM
The number of 16 bit sequences containing exactly eight 1 bits is 16 choose 8, or 16! / (8! * 8!). One of the 8! cancels out giving 16*15*...*9 / 8!

http://en.m.wikipedia.org/wiki/Combination
permutation or combination or neither ? Quote
04-11-2015 , 09:43 PM
^What he said. If you need the actual bits, use gosper's hack:

http://en.wikipedia.org/wiki/Combina...m#Applications
permutation or combination or neither ? Quote

      
m