Re: Appoximating large numbers




Bit Twiddler wrote:
If you could figure out shorter representations for an arbitrary integer,
you could be famous for defying the laws of combinatorics. There are
around 10^100 100 digit integers, and around 10^99 99 digit integers.
10^99 is one tenth of 10^100. In other words, any lossless compression
algorithm will be unable to make 90% of the random integers you give it
even *one digit shorter*.

Um, I didn't mean to hit a nerve or anything. I am not trying to do

You didn't hit a nerve, just an impossibility, like a 3-sided square.

something spectactular here, I simply was wondering if there was a known
method to reduce the size of the integers a bit (no pun intended).

There is nothing that will help in general.
You haven't given enough information for us to know
whether anything will help in your specific case.
My expectation is that you will not be
able to compress individual integers.
You *might* be able to use duplication.
Probably you are already storing integers
as pointers to their representations,
so that copying an integer just copies its pointer.
Extending the idea by allowing a pointer to a formula might
save you some space at the expense of considerable time.
For example, if you need X, Y and Z=X*Y,
storing Z as X*Y will save space.
If X and Y aren't needed, it will just cost you time.

.