# bounded Cantor pairing?

Mathematics Asked by Some guy on August 21, 2020

I know this is not the coding stack exchange but the first three paragraphs just pertain to the background (I hope it is not too jargon heavy). My question itself is more mathematical. Also I don’t have that much knowledge regarding mathematics.

I am a hobby programmer doing some things with poker abstraction. I currently have cards encoded as unique integers.

Anyway, For the purpose of constructing a unique id for each game-state (Hand, Flop etc…) I would like to exploit a recursive pairing function which expands with the previous result and each new card that comes into play, and suite relations. I am aware of Cantor’s pairing function and similar methods. But these will quickly overflow (i.e. the numbers become too large for my script to handle). But I am guessing it should be possible to construct a sort of ‘bounded’ pairing function in order to keep the expansion rate somewhat in check?

All be possible states in poker (barring bet-sequences) amount to 2,428,287,420. So it should be possible to create a function that maps each state to a max value of 2,428,287,420. For reference, the amount I can hold in a 3 byte integer (my goal) is 4,294,967,296.

I wish to instate a pairing function where one axis is ‘bounded’. For example, in the image below:

cantor pairing image

if I knew A priori that for all usages of the function y < 3 I would never have to map (0,3) to 9. Instead I could map (4,0) to 9 and thereby compress the output of my function. sadly I found little reference how to do this (or if it is possible with a relatively simple formula).

could you guys nudge me in the right direction?

## Related Questions

### Questions about parameter estimation for the Cauchy Distribution.

1  Asked on January 31, 2021 by yepyep123

### Compute the indefinite integral

0  Asked on January 31, 2021 by starr

### Tautology by default?

0  Asked on January 30, 2021 by zaphenath-paneah

### Does continuity guarantee existence of double integral?

1  Asked on January 30, 2021 by othi

### $f(x)=sum_{n=1}^{infty} {4^{1-n}} {h(4^{n-1}x)}$ is continuous and nowhere monotonic,$h(x)=vert x vert$ with period 1,$vert x vert leq 1/2$

1  Asked on January 30, 2021 by sharlin

### A geometry problem with the reflection of the incenter

5  Asked on January 30, 2021 by pet123

### How to determine if vectors span a plane?

4  Asked on January 30, 2021

### How can we make it easy to solve quadratics without the Quadratic Formula?

3  Asked on January 30, 2021 by user864449

### Solving state-space function with using of Runge-Kutta method

1  Asked on January 30, 2021 by makshe

### Where does $f_n$ converge pointwise, is it uniformly convergent?

1  Asked on January 30, 2021

### What is the correct shape of the sine integral?

1  Asked on January 30, 2021

### Does there exist a natural number pair $(a,b)$ such that $a^2b+a+5$ divide $ab^2+a+b$?

1  Asked on January 29, 2021 by user795084

### Over counting with symmetry

1  Asked on January 29, 2021 by shiv-tavker

### Understanding why the answer is no?

1  Asked on January 29, 2021

### Expectation of Computational Complexity for a dense matrix linear system

1  Asked on January 29, 2021

### Expected norm of first $d$ coordinates of the $n$-dimensional sphere

2  Asked on January 29, 2021 by godsbane

### Does anyone know how to find H in this question?

0  Asked on January 29, 2021 by dwij-bhandari

### Laplace eigenvalues on unit disc intermediate step

1  Asked on January 29, 2021 by azamat-bagatov

### How to check if a digraph is strongly connected with its adjacency matrix?

2  Asked on January 29, 2021 by javier-cf

### Confusion on analytic continuation.

1  Asked on January 29, 2021