# How do I turn a huge number into a few bits?

#### binaryloop

##### New member
Say I have the number 94728228010056348223853483453583434753322

I need to turn it into about 3 bytes of data.

I know it's possible because 9^9+1 = 387420490

My problem is how do I get the exact large number? I'm sure there's a mathematical rule to get the starting numbers needed here to initiate it... As you can see above, I added a +1, to adjust the result further.

Maybe some sort of exponential greedy-wise.

Last edited:

#### HallsofIvy

##### Elite Member
And I am just as sure you cannot do that! Three bytes is 24 bits. No matter what formulas you use, exponential or "exponentials of exponentials", you cannot have more than $$\displaystyle 2^{24}= 16,777,216$$ different patterns so cannot represent more than 16,777,216 different numbers.

#### Dr.Peterson

##### Elite Member
Can you explain what you mean by "turn it into about 3 bytes of data", and what your reasoning is? What does "the starting numbers" refer to?

You may mean something different from what I would mean, since as Halls said, that is impossible!

#### binaryloop

##### New member
Yes I mean exactly that haha. True, there is not as many small numbers as large ones...But there is as many types of characters and functions. For example '^' is not part of ny of the numbers, 'x' isn't, abwTy isn't, '/' isn't.

I need a wa to get close to the number, so that I can store a MB-long number in well, x1000 times smaller space.

#### JeffM

##### Elite Member
If I understand what you just said (and I probably do not because what I understand you to have said is virtually idiotic), you are arguing that the number of possible "digits" is unlimited in principle and that therefore any positive integer number can be represented by a single digit and that therefore any positive integer can be represented by a single byte.

WRONG

Bytes are eight bits of 1's and 0's, not a's, b's, asteristks, at signs etc. Therefore a single byte can represent only 256 integers exactly.

You can represent very large numbers in a small number of bytes if your numerals are to base 256. Have fun

#### Dr.Peterson

##### Elite Member
Yes I mean exactly that haha. True, there is not as many small numbers as large ones...But there is as many types of characters and functions. For example '^' is not part of any of the numbers, 'x' isn't, abwTy isn't, '/' isn't.

I need a way to get close to the number, so that I can store a MB-long number in well, x1000 times smaller space.
I suggested that you explain what you mean; you haven't. What is your goal? Why do you want to do this? It is possible that what you really need is something that is possible; for example, perhaps you don't need to encode every 41-digit number as a distinct 3-byte value, but have only perhaps 10 million numbers in that vicinity to encode. After all, if you only want to encode that one number, you can just write it as 1, with a function for which f(1) = 94728228010056348223853483453583434753322 !

But you'll have to say something to convince us that you know what you're talking about.

#### binaryloop

##### New member
I decided that 20 bits can store 1,000,000.....so me=stupid.......binary storage rules. I get double for each bit. Every 3 bits is 3 zeros worth (or 3 bytes).

#### Dr.Peterson

##### Elite Member
You're saying 3 bits can hold 3 bytes? And what does "3 zeros worth" mean? I'm confused.

You're right that 20 bits can hold numbers up to a little more than 1 million. But 3 bits can hold 8 possible values, and 3 bytes can hold about 16 million. Your number you asked about is a lot bigger than that. Where are you magically generating storage space?

You also haven't explained how 9^9+1 = 387420490 is related to this, or why you are asking this question.

#### binaryloop

##### New member
My mistake, I meant 3 bits is one zero in a ordinary number. 10 bits, is 3 bytes. 1GB of 1s & 0s in binary can store sooooo many entities. Image 10 bits. 10 bits is really 1,000. Now imagine 1,000 entities - 000000000000000000000000000000000000000000000000................. Now images what not 10 bits is, but 800,000,000,000 bits is!

The 9^9=n was about using very little bits to make a big number. I want to make 10MB into 100 bytes, 9^9 ^ 9 ^ 9 ^ 9 ^ 9 can generate a number so big we can't even run the calculation. Unfornunately I don't know how to control it enough. So many big results, so few starter bits, not possible really.....but for some cases, yes! I can generate a huge movie using a few bits. Imagine that!

#### binaryloop

##### New member
Actually that's bugging me, wait, 8 bits is 1 byte. 24 bits is 3 bytes. When I say that 1111111111 in bits is 1,000 in bytes, that is 10 bits = 3 bytes.....huh? Ah, 8 bits IS 1 byte. But when we have those 10 bits, it acts like a 4 bytes number (1,000). Woah...

#### JeffM

##### Elite Member
A byte is a group of bits treated as a unit. Usually it contains 8 bits.

So 3 bits = 3 bytes makes no sense.

If you had a computer, where each byte contained 3 bits, a byte could represent only 8 distinct things.

Do you have a clue what you are talking about?

#### binaryloop

##### New member
See my posts above. Yes, I understand well. There is however tricks though....everywhere

#### Dr.Peterson

##### Elite Member
My mistake, I meant 3 bits is one zero in a ordinary number. 10 bits, is 3 bytes. 1GB of 1s & 0s in binary can store sooooo many entities. Image 10 bits. 10 bits is really 1,000. Now imagine 1,000 entities - 000000000000000000000000000000000000000000000000................. Now images what not 10 bits is, but 800,000,000,000 bits is!

The 9^9=n was about using very little bits to make a big number. I want to make 10MB into 100 bytes, 9^9 ^ 9 ^ 9 ^ 9 ^ 9 can generate a number so big we can't even run the calculation. Unfornunately I don't know how to control it enough. So many big results, so few starter bits, not possible really.....but for some cases, yes! I can generate a huge movie using a few bits. Imagine that!
I think you may be confusing binary and decimal - and something more. A byte is not a decimal digit, but 8 binary digits.

The fact that we can store 1000 in 10 bits means that, for example, the decimal ("ordinary") number 1000, written in binary, is ‭1 111 101 000‬, which takes 10 bits (binary digits). With ten bits, you can store any of 1024 different numbers (one at a time, of course).

What you apparently mean by "3 bits is one zero" is that each digit in a decimal number (that is, each factor of 10) corresponds to about 3 bits. As we've said, 3 bits actually holds 8 numbers (0 through 7: 000, 001, 010, 011, 100, 101, 110, 111), so you're slightly overestimating it.

But the rest of what you're saying makes no sense at all, in terms of what bits actually mean.

Your second paragraph suggests that you aren't thinking of number systems and bytes and bits at all, but about a very different challenge: how large a number can you express using a given small number of characters in a mathematical expression; or, conversely, how few symbols can you use to express a given large number (which is a much harder challenge). Yes, some special numbers can be obtained very compactly, but that doesn't mean that any given number can - for exactly the reason we've been discussing.

Sometimes we see discussions about what is the largest number you can "write with three digits". They will say 9^(9^9); but depending on the rules of the game, 9!^(9!^9!) is much bigger, and you can go far higher than that. But that's just a silly puzzle, not something interesting about actually representing numbers in general. Most numbers can't be written so compactly.

Am I guessing correctly what you have in mind?

Yeah

#### Dr.Peterson

##### Elite Member
By the way, a byte is also used to store a single character (using ASCII -- modern systems use two bytes), so perhaps that is what you originally meant by "about 3 bytes of data" -- not numerical, but character string data. So "9^9" could be stored in three bytes.

But even allowing any three printable characters, very few numbers could be stored this way. Allowing perhaps 26 letters and 10 digits and 20 symbols or so (not all of which would represent numbers), at most you could have 56^3 = 175,616 different numbers in three bytes. Among them would be "two", "9*9", and "999", and maybe you could make up a code using nonsense strings. But doing this would never give you more possibilities than just taking it as binary (24 bits) would.