Search code examples
binarynumberspermutationfactorial

Factorial of binary numbers, Not as it seems


Start off factorial of 4 is 24.
Which means 24 different permutations possible.
But I seem to keep getting only 16 different permutations for 4 different binary numbers.
Seems its like 4x4=16

I did this by hand maybe I missed one.

1= 0, 0, 0, 0
2= 0, 0, 0, 1
3= 0, 0, 1, 0
4= 0, 0, 1, 1

5= 0, 1, 0, 0
6= 0, 1, 0, 1
7= 0, 1, 1, 0
8= 0, 1, 1, 1

9= 1, 0, 0, 0
10= 1, 0, 0, 1
11= 1, 0, 1, 0
12= 1, 0, 1, 1

13= 1, 1, 0, 0
14= 1, 1, 0, 1
15= 1, 1, 1, 0
16= 1, 1, 1, 1


Solution

  • For 24 different patterns, it requires at least 5 bits in binary to represent the information. Only 16 patterns are forming because of 2^4 not 4*4. You just add another bit position to the numbers and your problem will be solved. I mean something like :

    1= 0, 0, 0, 0, 0
    2= 0, 0, 0, 0, 1
    .......
    .......    
    15= 0, 1, 1, 0, 1
    16= 0, 1, 1, 1, 1
    .....
    24=1, 0, 1, 1, 1