I was playing with the exterior algebra, and stumbled on this interesting function from $\Bbb N^2 \to \Bbb N$, which I'll call $f(x,y)$. This is plotted from $1 \leq x,y \leq 100$:
In this picture, yellow values are higher, blue values are lower. So you can see the function is at its lowest when $x:y$ is closest to a simple ratio.
For all $x$, we have $f(x,x) = 2$. However, for sufficiently large $x$, we also have $f(x,x+1) = 3$, $f(x,x+2)=4$, etc, so this function is also in some sense measuring the distance to the nearest low-slope line.
In comparison, here's the gcd(x,y) function:
So you can see that while both functions feature prominent rational slopes, that the first one seems to be "smoothed" relative to the GCD, and also reaches minima at rational slopes rather than maxima.
Is there some simple function that this resembles?
Here is a CSV, if anyone wants to play with it, but due to the way I calculated this function, there may be some sporadic errors (though should be good for $x,y < 50$ or so: https://pastebin.com/raw/vEWAdBVM
Just to say how I got this function:
So for each $x,y$ pair, I generated the vector $(x,y,1)$. Then, I wanted to find the "shortest" integer bivector that is the wedge product of $(x,y,1) \wedge v$ for some $v$ with integer coordinates. This is a plot of the norm of the resulting shortest bivector for each $(x,y)$.
I was using the $\ell_1$ norm to measure shortest for the thing I'm doing, but you get the same basic plot with the $\ell_2$ norm, as well as any $\ell_p$ norm.
For each $(x,y)$ pair above, I ran a Monte Carlo search testing 10000 randomly generated bivectors and took the best one; after a few tries everything converged to the plot above.
If you start with $(x,y,0)$ instead, you seem to get the basic GCD function instead, but $(x,y,1)$ gives the "smooth nega-GCD" pattern above.
I was surprised to find something so simple and beautiful from such a strange starting point!