Answer the question
In order to leave comments, you need to log in
Is it possible to encode some number of digits into less?
For example, is it possible to encode 11 digits into 9 and then decode them? Personally, this seems impossible to me (each digit carries a certain amount of information and it will not be possible to refuse it), but maybe there are some tricky algorithms.
Answer the question
In order to leave comments, you need to log in
There is such a science - mathematics.
She says that one cannot map 10^11 values to 10^9 one-to-one.
11 digits [0-9] to 9 digits [0-9] is not possible.
And 11 digits [0-9] into 9 characters [0-9a-zA-Z] is easy.
Can. Change the number system to a higher one and you will be happy. For example, the number 99 999 999 999 (10) is the same as 247BAFB5E (17)
The question is incorrect.
In the general case, if the information is chaotic, it is impossible to reduce its volume.
In specific cases, it often has some order that can be used to replace this information with the logic by which it can be re-created. This is how archivers work, for example.
If each digit is represented by one byte of the ASCII table, then it can be encoded into fewer bytes .
For example, let's take the number 12345678901. It has 11 digits. If we represent each digit with the corresponding ASCII table code (Ruby code)
n=12345678901
n.to_s.each_codepoint {|c| print c, ' ' }
49 50 51 52 53 54 55 56 57 48 49 => "12345678901"
puts n.to_s(2) # конвертация в строку по двоичной системой счисления
1011011111110111000001110000110101
puts n.to_s(2).size
bytes = [n].pack('w') # кодирование числа в BER.
=> "\xAD\xFE\xF0\xB85"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question