[Tutor] Re:Base 207 compression algorithm
cino hilliard
hillcino368@hotmail.com
Thu Jun 26 17:10:09 2003
The number compression ratio for my base 2 - 207 compression algorithm is
log(10)/log(b). Thus if we
compress a 1000000 digit number base 10 to base 207 we have a compression
ratio of log(10)/log(207)
= 0.43178... The best we will be able to do with a character set with codes
up to 999 is about 1/3.
Thanks,
3 3 3 3 3 6 2
(0^0)
2 + 13 + 33 + 43 = 49 = 7 = 343 = 117649
>From: "cino hilliard" <hillcino368@hotmail.com>
>To: tutor@python.org
>Subject: [Tutor] Re:Base 207 compression algorithm
>Date: Thu, 26 Jun 2003 19:32:01 +0000
>
>To:Jeff Shannon and all other Python users
>
>Cino Hilliard wrote:
>>># we can determine the compression ratio for various bases. # Eg., base 2
>>>= 332%,
>>># base 8 =111%, base 10 =100%, base 100 = 50%, base 207 = 43.2%.
>>
>>
>Jeff Shannon wrote:
>>This is mistaken, because you're only changing how many characters are
>>used to display it on the screen. No matter what base it's displayed in,
>>it is still *stored* in binary, and this will not compress anything.
>>Whether you see 'FF' or '255' or '@' (or whatever other character might be
>>used to represent that number in whatever base you try to use), it still
>>must occupy one byte of memory / hard drive space. Once again, you're
>>confusing the display with internals. Changing the base only affects
>>display.
>
>Does anyone else in the python community agree with this?
>
>
>Attached is a script that can be used to zip numbers. It is a base 2-207
>compression algorithm that I
>developed using python's arbitrary integer precision feature. Base 207 was
>used for the output in this
>example.
>
>Here is the output for 5000 digits of Pi stored to two files pib10.txt for
>the decimal expansion and
>pib207.txt for the base 207 conversion. I included Win Zip and pkzip files
>also. You will notice that the
>compression in base 207 gives a better ratio than the Zip file compression.
>The compression ratio
>improves logorithmically with increasing bases.
>
>
>Also shown is the compression for 1000! in base 207.
>
>This is in no way intended to imply that this code is better than the
>professional zip code. It is just a
>demonstration of ways to compress a string of numbers using base
>conversion. Currently, it only works
>on numbers.
>
>
>C:\Python23>dir pib*.*
>Volume in drive C has no label.
>Volume Serial Number is E834-0F93
>
>Directory of C:\Python23
>
>06/26/2003 12:37 PM 5,000 pib10.txt
>06/26/2003 12:37 PM 2,159 pib207.txt
>06/26/2003 12:44 PM 2,665 pib10.zip
>06/26/2003 01:34 PM 2,594 pib10pk.ZIP
>06/26/2003 02:02 PM 2,568 fact10.txt
>06/26/2003 02:02 PM 1,109 fact207.txt
>
>_________________________________________________________________
>MSN 8 with e-mail virus protection service: 2 months FREE*
>http://join.msn.com/?page=features/virus
><< practical.py >>
_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8.
http://join.msn.com/?page=features/junkmail