3 ms·
The second answer, 15.676, is the correct one. It can also be arrived at by: log2(32C4 + 32C3 * 3 + 32C2 * 3 + 32C1)
by pishpash 9y ago
The second answer, 15.676, is the correct one. It can also be arrived at by:
log2(32C4 + 32C3 * 3 + 32C2 * 3 + 32C1)
- bubblethink 9y agoI followed the original link as well as this calculation. Why not use this to map them directly (instead of breaking it into 12 bits and 4 bits) ? We'll just have some unused headroom in 16 bits. This would seem more natural than thinking of the 12 + 4 solution.
- bonzini 9y agoIt uses more memory.
- bonzini 9y agoWhat the parent message did is: log2(32+4-1 C 4), because the number of k-sized combinations of n objects with repetitions is (n+k-1)Ck. One way to prove it is that you sort the objects (so you can establish an order among the objects in the combination) and add k-1 dummy objects for "the second is the same as the first, the third is the same as the second,..., the last is the same as the penultimate".