I have 2 different numbers, from example 7 and 8. I need generate third "unique" number using given numbers, that is, if from 7 and 8 we obtain some X number, this X number not will be obtain from some other 2 numbers, X must be generate only from 7 and 8. can make this? Thanks
|
closed as not a real question by martini, William, Noah Snyder, draks ..., J. M. Oct 5 '12 at 13:00
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, see the FAQ.
|
If the order matters and your two numbers are X and Y you could try things like: $2^X3^Y$ or $(10^X-1)10^Y$ or $2^X(2Y-1)$ But the original question doesn't state whether X and Y can be zero or negative etc, and the kind of function you choose depends on what you want to use it for. |
|||
|
|
So what you want is an injective function $\mathbb N\times\mathbb N\to\mathbb N$. There are many possible choices for that -- one of the simplest (among those that don't waste space by leaving many possible results unused) is $$(a,b)\mapsto \frac{(a+b)(a+b+1)}2 + a$$ which is known as Cantor's zig-zag. |
|||
|
|
|
If $a,b$ are nonnegative integers, then you can let $$x = \frac{a-b-1+(a+b+1)^2}2.$$ This $x$ will always be a non-negative integer and different inputs produce different values of $x$. In fact, this method is not wasteful: All nonnegative numbers $x$ can be obtained by a suitable (and unique) choice of $a$ and $b$. |
|||
|
|
|
Are the numbers positive integers, or can they be arbitrary real numbers? Does the order of the numbers matter, or can the numbers $7$ and $8$ generate the same number $X$ as the numbers $8$ and $7$? I will assume that the numbers are positive integers, and that the order of them does not matter. Then you can put all your pairs of numbers in a long sequence, and count along the sequence to get your number $X$. For instance, you can use the sequence $$(1,1)\qquad (1,2)\qquad (2,2) \qquad (1,3) \qquad (2,3) \qquad (3,3) \qquad (1,4)\ \ \ \ \ \ \ \ \ \ \ \ $$ $$(2,4)\qquad (3,4)\qquad (4,4) \qquad (1,5) \qquad (2,5) \qquad (3,5) \qquad (4,5) \quad {\rm etc.}$$ Following this pattern, your pair of numbers $7$ and $8$ will then be the $35$th element of this sequence, so $X=35$. (It is in principle possible to do this for real numbers too, since ${\Bbb R}^2$ and $\Bbb R$ have the same cardinality, but you will not get an explicit expression for $X$ in that case.) |
|||||
|

