3 ms·
Here's a little puzzle for you: A-F are 3/8ths (6 of 16) of the hex digit set, yet only 1/6th (3 of 18) bytes in 'America Can Code ' have A-F. Why the large di
by gohrt 13y ago
Here's a little puzzle for you:
A-F are 3/8ths (6 of 16) of the hex digit set, yet only 1/6th (3 of 18) bytes in 'America Can Code ' have A-F. Why the large discrepancy?
- TheCoelacanth 13y agoTo start with, only 7 of the 26 letters (uppercase and lowercase letters are only different in the first digit, which is never higher than 7 in ASCII, so I'm ignoring the difference) in the alphabet have an A-F in one of the digits, so in a text composed only of letters with all letters being equally likely, the frequency of A-F would be 26.9%. Additionally, A-F occur disproportionately in infrequently used letters. Adjusting for the frequency of letters in English[1], the expected frequency of bytes with A-F is 21.7%. The space character also doesn't have an A-F, so that will lower the frequency further. If we assume that the frequency of spaces is the same as in "America Can Code ", (17.6%) the expect frequency of A-F comes out to 17.9%. That's very close to the number in "American Can Code " (17.6%). [1] http://en.wikipedia.org/wiki/Letter_frequency#Relative_frequencies_of_letters_in_the_English_language http://en.wikipedia.org/wiki/Letter_frequency#Relative_frequ...