# What are all the possible 5-digit binary code combinations?

by univeruser
Tags: 5digit, binary, code, combinations
 P: 54 Hi all. I recently am thinking of developing a compression software with extreme speed and compression. The simple principle behind the working of this software is that the software is converting the program into binary code. Then, five sets of 0s and 1s are converted into alphanumeric characters. Like for example, 00101 becomes 2 (number); 01101 becomes, say, y (alphabetical character); 01111 like, say, # (special characters); 11111 as to J (CAPS); and so on. But as far as for now, I require to get a list of all five digit combinations of 0s and 1s possible. For the time being, I'll manage with 5-digit sets of binary code. I could later expand the compression efficiency using ten digits, and so on.
P: 1,717
 Quote by univeruser Hi all. I recently am thinking of developing a compression software with extreme speed and compression. The simple principle behind the working of this software is that the software is converting the program into binary code. Then, five sets of 0s and 1s are converted into alphanumeric characters. Like for example, 00101 becomes 2 (number); 01101 becomes, say, y (alphabetical character); 01111 like, say, # (special characters); 11111 as to J (CAPS); and so on. But as far as for now, I require to get a list of all five digit combinations of 0s and 1s possible. For the time being, I'll manage with 5-digit sets of binary code. I could later expand the compression efficiency using ten digits, and so on.
That doesn't do any compression. You are replacing a fix bit pattern with a character that will require some encoding itself. If you pick 32 characters, then you get no compression. If you use 7 bit ascii for your characters, you INCREASE the size of the input by 40%.

Cheers -- sylas
P: 592
 Quote by univeruser But as far as for now, I require to get a list of all five digit combinations of 0s and 1s possible.
32 = 25

In fact, for any n-digit binary number, it's always equal to 2n.

P: 54

## What are all the possible 5-digit binary code combinations?

I see. I hope this new algorithm works.

Let's say we replace each set of characters with only 0s or 1s. That gives us only two numbers that can be converted.

Let's take this to be the code of a program:

0111100000111010101010000000101001010010010101001000000000010100101001000000111

Which sets of numbers do occur here the most? It's 00000 and 10101. Let us replace the 00000 with 0 and 10101 with 1. The source code is now:

011110111010100010100101001001001001010010100100111

So we have reduced, that is, in essence, compressed the binary code by 35 numerals.

Now we shall have secondary, tertiary and several more compressions, all using the sets 10101 and 00000 replaced by 1 and 0 respectively.
P: 1,717
 Quote by univeruser I see. I hope this new algorithm works. Let's say we replace each set of characters with only 0s or 1s. That gives us only two numbers that can be converted. Let's take this to be the code of a program: 0111100000111010101010000000101001010010010101001000000000010100101001000000111 Which sets of numbers do occur here the most? It's 00000 and 10101. Let us replace the 00000 with 0 and 10101 with 1. The source code is now: 011110111010100010100101001001001001010010100100111 So we have reduced, that is, in essence, compressed the binary code by 35 numerals. Now we shall have secondary, tertiary and several more compressions, all using the sets 10101 and 00000 replaced by 1 and 0 respectively.
You are on the right track, although because you now have different lengths for encoded characters you must be able to recognize when they start and end. If you replace a certain code with "0" and another code with "1", you have no more binary digits available. The first 0 of your string would be the code for 00000.

The method you are approaching is called Huffmann coding (wikipedia link). Basically you calculate the frequency of all your "characters" and then pick a number of bits for each one so that you can recognize them unambiguously and also get the maximum compression (or minimum entropy).

Cheers -- sylas
 P: 54 I did forget to add on. In this compression method, not only is the most common number set replaced, but the computer computes out the most common set in the binary code. Following the primary encryption, say that we have the binary code (as previously mentioned): 011110111010100010100101001001001001010010100100111 What's most common here? Obviously 10010 and 00101. We'll take 0 and 1 for them respectively. So now, it's: 0111101110101000101101001110111 We have compressed it by 25 digits. Let us do it again. Here, 000 and 0111 are most common; replace them with 0 and 1. I do understand that they aren't five digits, but it can vary if there aren't much possibilities. 11101010101101001111 It has been reduced by a further 11 digits. And again we shall do it. 010 is 0; 111 is 1, both are the most common sets. 1010110011 I shall show in the next post how I continue this until I achieve about a maximum 7 letters. It is about as enough, since I have reduce the binary code from 79 characters to a mere 11 characters, approximately 86.075% cut off the original size. What an excellent job, I must say!
P: 1,717
 Quote by univeruser I did forget to add on. In this compression method, not only is the most common number set replaced, but the computer computes out the most common set in the binary code. Following the primary encryption, say that we have the binary code (as previously mentioned): 011110111010100010100101001001001001010010100100111 What's most common here? Obviously 10010 and 00101. We'll take 0 and 1 for them respectively. So now, it's: 0111101110101000101101001110111 We have compressed it by 25 digits. Let us do it again. Here, 000 and 0111 are most common; replace them with 0 and 1. I do understand that they aren't five digits, but it can vary if there aren't much possibilities. 11101010101101001111 It has been reduced by a further 11 digits. I shall show in the next post how I continue this until I achieve about a maximum 7 letters. It is about as enough, since I have reduce the binary code from 76 characters to a mere 20 characters.
As I pointed out above, you have a problem uncompressing this.

When you see the compressed string, how do you tell whether the first bit (which is either 0 or 1) is one of your common strings, or a part of a longer string that is not so common?