Hacker News new | past | comments | ask | show | jobs | submit login

<http://en.wikipedia.org/wiki/Combination#Number_of_combinati...; tells you there are N=10^8+10^6-1 over 10^6 different multisets of 10^6 8-digit numbers (including numbers starting with zero digit(s))

A quick and dirty Python program computing the logarithm in base 2 of N in Python gives me 8093729.48175.

So, one can encode a number in the range [0, N) in 8093730 bits, or 1011717 bytes (possibly a few more due to rounding, but that is far enough from 1MB=1048756 to not worry about that)

Arithmetic coding replaces that [0,N) integer by a floating point number in [0,1) by dividing by 2^(8MB), but that does not make a difference.

So, there is plenty of room to store one such number. That leaves the problem of replacing one such number for K eight-digit numbers by one for K+1 eight-digit numbers. I'll leave that as an exercise :-) because you did not ask for it and because I cannot think of an easy proof.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: