for fixed $n \geq 0$ (natural number) and $0 \leq i,j \leq n - 1$ i have this function for $0 \leq i + j \leq n - 1$ $$r(i,j) = \left( \sum_{l = 1}^{i + j - 1} l \right) + j$$
otherwise for $n \leq i + j \leq 2n - 2$ i'm trying to define the function by a simmetry respect to the constraint $i + j = n - 1$
specifically what i'm looking is something like $r(n-1,n-1) = n^2 - 1$, $r(n-1,n-2) = n^2 - 2$ and so on...
So for $i+j \geq n - 1$ i want something that $r(i,j) = f(r(n-1-i,n-1-j))$
Is it clear what i mean? I would like to find the function $f$ with the desired properties.
Another properties i'm looking for is the invertibility of the functions (i.e. for given $n$ i want to retrieve the couple (i,j).
Your sum is simple: $$ r(i, j) = \sum_{1 \le l \le i + j - 1} l + j = \frac{(i + j - 1) (i + j)}{2} + j $$
I don't understand your "constraint" and "symmetry" tough...