the answer is not quite 30%. i used Golomb coding here, but Huffman yields a very similar result.
also this code is kinda bleh (i even just spotted a var called 'asdf' and an off-by-one) but i don't feel like working on it anymore tonight.