if i convert a file's contents into a single l

2019-06-10 23:57发布

assuming the mathematical expression has less number of characters than the original number. example-

20880467999847912034355032910578 can be expressed as (23^23 +10)

this looks like a good compression method. Will it work for compressing large files?

UPDATE- i didn't mean converting a file into a large binary number. lets say i have a text file and i replace all the characters in it with their ascii values. now i have a large number in the decimal number system. i can express it as a mathematical expression like in the example above.

3条回答
干净又极端
2楼-- · 2019-06-11 00:18

If you take the contents of a file as a large binary number, and find an expression which evaluates to that number and can be stored more compactly than the number itself, then yes, you have compressed the file.

Unfortunately, for most files, you'll never find such an expression.

Simple logic (see the link posted by @OliCharlesworth) should convince you that it's impossible to find such an expression for all or even most files. Even for files which might have a suitable expression, finding it will be very, very difficult. If you want to convince yourself of this, try this challenge:

Take the following ASCII string:

"Holy Kolmogorov complexity, Batman! Compress this sucker down good and you'll get a pretty penny, my fine lad!"

Interpreted as a binary number, with the high-order digits coming first, that is: 2280899635869589768629811602006623364651019118009864206881173103187172975244099647369151382436996220022807793898568915685059542016541775658916080587423284053601554008368389985872997499032440860090224967472423163775276043175694884234152335588829534778866153948275745.

Try to find a polynomial which evaluates to that number. All the numbers used must be integral, and the total number of decimal digits appearing in the polynomial must be less than 80. If you succeed, I will send you a small cash prize by PayPal.

查看更多
Lonely孤独者°
3楼-- · 2019-06-11 00:38

The notion you're looking for is Kolmogorov complexity - it's a measure of how algorithmically incompressible a number is. See this wiki article for a rigorous definition and examples of such numbers.

查看更多
smile是对你的礼貌
4楼-- · 2019-06-11 00:40

Yes, by definition. You have correctly defined compression as representing something larger with something smaller.

How do you propose to do this? How often will that work? There's the rub.

查看更多
登录 后发表回答