Answer the question
In order to leave comments, you need to log in
Is there a formula for reversibly converting four numbers into one?
Is there a formula with which you can somehow connect 4 numbers and then divide this result into the same 4 numbers?
Answer the question
In order to leave comments, you need to log in
1. You can treat each number as a digit. This will allow you to add and decompose as many numbers as you like (see the formulas for extracting digits).
For example, let's say we have 4 numbers, each of which can be 0-9. Then, a two-way transformation of the form is possible: 1 + 2 + 3 + 4 = 1234.
2. Combine the textual notation of numbers, and then split it into 4 equal parts.
3. Represent each pair of numbers as xy, and then represent the total number as a+i*b (complex). For example: 1 + 2 + 3 + 4 = 1.2+3.4i. In this case, it is even possible to get a "free" hash using the Euler formula: 1.2+3.4i => 3.6*e^1.23i.
Suddenly, declaring a struct in C or a class with members in any OOP language as such a "formula" works. The computer stores several "numbers" in one block of memory and can reversibly convert this same block into these same numbers. Without bicycles.
Looking what numbers and for what. For non-negative integers, the formula has already been given. If you wish, you can even come up with a formula with a one-to-one correspondence: (2a+1)2^((2b+1)2^((2c+1)2^d-1)-1)-1. I doubt, however, that it is suitable for anything practical.
For real numbers, apparently, you can’t come up with an explicit formula, but in general it’s not a problem to build a correspondence. Again, the idea of \u200b\u200bcombining numbers by digits has already been given. Again, if you wish, you can come up with a scheme with a one-to-one correspondence. For example, by combining continued fractions with the formula from the previous paragraph. I leave the details as an easy exercise ;)
It's simple: there are three numbers (time) 14:22:55
hh = 14
mm = 22
ss = 55
Let's write it as a single number:
num = hh*10000+mm*100+ss = 142255
result: 3 numbers turned into one.
If in relation to programming, then the binary shift operation is used there instead of multiplication.
Your original numbers can be immediately considered as one long number if you put them side by side :)
If each of the numbers took 32 bits, then their total representation will take 128 bits.
In practice, though, it's easier to work with strings.
R n and R are equal in power (have the power of the continuum), i.e. e. it is possible to build a one-to-one correspondence between real numbers and their n -kami ( n=4 is no exception). But the formula of simple arithmetic operations, apparently, is not enough, but, probably, bitwise processing of writing numbers in some local ( non -Russian positional) number system is needed, for example, first we write out the 1st digit from each number, then 2 -Yu…
It can be easy to play around with separators, for example, you stupidly concatenate numbers with a separator 12345, and if such a sequence occurs in the original numbers, then you screen it first with the same set, for example, then the process is reversed during parsing.
Perhaps, in order not to reinvent the wheel on escaping yourself, it is better to find 2 tools, from the beginning in which escaping with strings is already ready, and the second is the conversion of numbers into letters.
Another option is 2^a * 3^b * 5^c * 7^d (^ - exponentiation)
Due to the uniqueness of the expansion into prime factors, it is possible to uniquely restore the four original numbers from the result.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question