# The smallest compression [closed]

What is the most compact way to store the sentence The quick brown fox jumps over the lazy dog without losing data?

Whatever way you think of must be explained and the process should be reversible.

I am not looking for a small way to store on a computer but for writing on paper.

• I'm voting to close this question as off-topic because this is a question about data compression algorithms and answers to such topics can be found on StackOverflow. – CodeNewbie Aug 18 '15 at 12:20
• Is this an acceptable solution? :-) pastee.org/52aun – Carl Löndahl Aug 18 '15 at 12:21
• Does everyone have to recognize the encoded form without agreeing on an algorithm beforehand? How do you judge the 'most compact' on paper? Size? Length? Number of different symbols? What stops me from arbitrarily defining a symbol as 'The quick brown fox jumps over the lazy dog'? Voting to close as unclear. – Tryth Aug 18 '15 at 12:34
• @AgeDeO You still really haven't addressed my questions. How do you judge 'most compact'? What stops me from defining a symbol for every word in the English language? Or a symbol for every combination of 43 characters from the alphabet and spaces? – Tryth Aug 18 '15 at 12:44
• You also have to specify what constitutes a valid compression algorithm. If you allow dictionary based compressions, you can put all the information into the dictionary and compress your sentence into T or whatever. – Cephalopod Aug 18 '15 at 12:56

Each letter is one of 26 separate characters. We could use a base-32 (2^5) storage format to store the numbers in binary. a would be 00001, b would be 00010, etc. This is assuming that you don't care about capitalization, which would double the required space.

The algorithm would require 43 characters of code for the entire sentence because some letters are duplicated. 43 * 5 = 215 bits, or just under 27 bytes.

To decrypt it we would simply grab 5 characters at a time and add the relevant values to their binary value to get their ascii codes.

Sorry, something's preventing me from using spoiler tags here.

• Changing one letter into 5 digits does not make the sentence smaller it makes it 5 times as big. I am not looking for a small way to store on a computer but for writing on paper. – AgeDeO Aug 18 '15 at 12:29
• ooOOOhhh... Wow, I kinda defaulted to programmer mode, sorry. – Kingrames Aug 18 '15 at 12:31
• no, Kingrames is correct. Instead of using one byte (8 bits) to encode each letter, he's using 5 bits, which would reduce the size. – dfperry Aug 18 '15 at 13:24

## Solution : change the base !

Compression

If you take each word as a number in base 26 (a=1, b=2 etc) you have a number. For example :

the = 20*26²+8*26+5=13733 (t=20, h=8 and e=5)<br>


Then you change the base. You can take base 255 (each value is an ascii character) and convert the number :

13733 = 53*255+218


You can convert your new numbers in ascii (base 255), and you get

5┌


You saves one character here, yayy !

Decompression

To decrypt the message you basically do the same thing reversed (from base 255 to base 26).

Edit :
I did it for the whole sentence and I found this : 5┌ }=☺ ‼§‗ ◄ç L↑; ♦A═ 5┌ ♥Cü ♀). It saves 12 characters.

TheQuickBrownFoxJumpOverTheLazyDog