Combining Numbers ReversiblyDate: 06/04/2003 at 16:29:14 From: Dene Subject: A formula to obtain two numbers from the formula result. Hello, I have been trying to find a way of getting two different numbers, combining them through a formula that will give a final number. From that new number it should be possible to get the two numbers back. For example, say you have the two numbers 49 and 637. You take the greatest number and multiply it by 10^n, where n is the number of digits within that number. Therefore, 637 * 10^3 = = 637000. Then, you add the the smaller number, which will give you the final number, 637049. The reverse to get the two numbers would be: 637049 / 1000 = 637.049 //first number 637049 mod 1000 = 49 This is the only method I have been able to come up with so far, and if you use further formulas and feed them into further formula calculations, the results go up exponentially, which is not what I am looking for. I need a formula where the result is not really more than double the sum of the two numbers, if there is one. Could you help me? Date: 06/04/2003 at 23:17:24 From: Doctor Peterson Subject: Re: A formula to obtain two numbers from the formula result. Hi, Dene. The fact is, the numbers you get HAVE to go up exponentially when you do something like this. That's because the information contained in a numeral is determined by the number of digits, and when you combine two numbers into one you are combining the information they contain, which means essentially multiplying the size of the numbers, or adding the number of digits. In general, combining their digits is the most efficient way to do this, and gives a way to measure the information content. For example, suppose we combine two two-digit numbers by concatenating their digits (in base ten): xx, yy --> xxyy. The total number of digits in the result is the sum of the number of digits in the input numbers. And it has to be this way, because there are 100 possibilities for the first number xx, and 100 for the second, yy; so there are 100*100 = 10000 possible combinations, and it takes four digits to distinguish them all. If you had a formula that would produce only three digits when it combined any two two-digit numbers, then there would not be enough different outputs to distinguish all input pairs; some combinations of inputs would have to produce the same output, and you could not reverse the formula. There are other specific ways to combine numbers reversibly. One that does not require you to decide ahead of time how big the numbers can be is to interleave their digits. For example, 049 and 637 might combine to make 064397. This can also be done in binary rather than decimal, which is more suitable for computers. But however you do it, the result is adding the numbers of digits. Here is a discussion of another approach to the same problem: Coding Pairs of Numbers http://mathforum.org/library/drmath/view/56036.html If you have any further questions, feel free to write back. - Doctor Peterson, The Math Forum http://mathforum.org/dr.math/ |
Search the Dr. Math Library: |
[Privacy Policy] [Terms of Use]
Ask Dr. Math^{TM}
© 1994-2013 The Math Forum
http://mathforum.org/dr.math/