Mapping an infinite set of numbers to a finite set

186 Views Asked by At

Not a mathematician but a programmer here.

Let us say I have an infinite set of numbers (that is a series) $X = \{x_1, x_2, x_3\dots\}$

I want to map each element in X, to a number in a finite set of numbers $Y = \{0, 1, 2\dots n\}$. $n$ is known and it is a natural number sequence.

The first operation I thought of was to have $X \mod n$ (modulus) to generate the mapping. My question- Are there any other operations that yield such a mapping between $X$ and $Y$ which are different from modulus?

If there are certain numbers missing in the natural sequence Y, what would be an approach to achieve the mapping?