# Function for unique hash code

I am interested in finding $F(x,y)$, such that $x$ and $y$ $\in \mathbb Z^+$ and $F(x,y)$ is one to one function i.e., $F(x,y)$ is unique for any unique unordered pairs of $x$ and $y$.

Regards,

Apologies for noobish language I am new to branch of number theory.

-

By writing "unordered pairs," you are asking that $F(x,y)=F(y,x)$, is that right? – Gerry Myerson Jan 16 at 8:55
Yes, precisely the order is immaterial . – user58460 Jan 16 at 8:58

## 1 Answer

$F(x,y)=(1+\max(x,y))^2-|x-y|$ will do.

-

Thanks, seems to be working well. How did you derive at this? Any specific property ? – user58460 Jan 16 at 9:09
I figured the easiest way was to get some function such that $F(x,x)$ increased pretty quickly with $x$ --- quadratically would do --- and then subtract something off it as you went away from $(x,x)$, subtracting more the farther down from or to the left of $(x,x)$ you went. That's what this function does. Along the $(x,x)$ line, it goes $1,4,9,16,\dots$, and it drops by $1$ for each step you take away from $(x,x)$. – Gerry Myerson Jan 16 at 10:43
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 18, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.947220504283905, "perplexity_flag": "middle"}