Consider a random sequence of numbers, like 1, 4, 15, 21, 27, 15... There are no constraints on what numbers may appear in the sequence. Think of it as each element in the sequence is obtained using a random number generator. The question is, do we have a function that will give unique output by performing mathematical operations on this sequence? By unique, I mean when the function is applied on sequence A, it must output a value that's different from the output obtained by applying the same function on any other sequence (or the same sequence but numbers placed in different order) in the world. If we don't have such functions, can you tell me if it is even possible? Do we have anything that gets close?
2026-04-24 11:23:11.1777029791
On
Is there a function that gives unique values when a unique sequence of numbers is given as input?
1.6k Views Asked by user351231 https://math.techqa.club/user/user351231/detail At
2
There are 2 best solutions below
2
On
There exists several such functions. Two different examples that are also surjective in a certain sense:
- continued fraction: $f((x_1,...,x_n)) = x_1 + \cfrac{1}{x_2+\cfrac{1}{\cdot \cdot \cdot + \cfrac{1}{x_n}}}$. Every positive rational $x$ can be written like that in a unique way (and every $x \in \mathbb{R}_+$ if the sequences can be infinite).
$ $
- Engel's expansion: $f((x_1,...,x_n)) = \frac{1}{x_1}+\frac{1}{x_1x_2}+\cdot\cdot\cdot+\frac{1}{x_1\cdot\cdot\dot x_n}$. Every positive rational $x$ can be written like that in a unique way (and every $x \in \mathbb{R}_+$ if the sequences can be infinite).
Assume each input sequence has finitely many terms, and all terms are nonnegative integers.
Let the function $f$ be given by $$f\bigl((x_1,...,x_n)\bigr) = p_1^{1+x_1}\cdots p_n^{1+x_n}$$ where $p_k$ is the $k$-th prime number.
Then by the law of unique factorization, the function $f$ has the property you specified.
More generally, if negative integer values are also allowed, then define $f$ by $$f\bigl((x_1,...,x_n)\bigr) =p_1^{e(x_1)}\cdots p_n^{e(x_n)}$$ where $$ e(x_k)= \begin{cases} 1+x_k&\text{if}\;x_k\ge 0\\[4pt] x_k&\text{if}\;x_k < 0\\[4pt] \end{cases} $$