what?
Closed this issue ยท 9 comments
clueless me - I don't see how one gets so few possibilities for 4 - 4 bit values ...
please elaborate!
otherwise we have just invented a new perpetual motion machine !
It seems strange, but here is a hint: the order of the values is information too. When you compress with this method, {1, 4, 2, 3} will compress and could potentially decompress into {1, 2, 3, 4}. The number of permutations of this set is 4!
, so the order contains log2(4!)
or about 4.5849625 bits of entropy.
This program creates a giant look up table that essentially maps the sequence into a set.
Oh, so the trick is that it stores 4 unsorted 5-bit values. It should probably be mentioned in the readme, as it's not exactly an insignificant detail.
It is mentioned in the README but kinda hidden. It says a "set" of 4 5-bit value. This should go in the title as well.
#!/usr/bin/env python
def main():
total = 0
for i in range(2**4):
for j in range(i, 2**4):
for k in range(j, 2**4):
for l in range(k, 2**4):
total += 1
print(total) # prints 3876
if __name__ == "__main__":
main()
Mine is not a full implementation, merely an explanation of the number pointed out in the README. Also no benchmarks
fixed in 46cd8c8