Whole Sequences – Mapping naturals to pairs of naturals and vice versa

I do not find much on the Internet about this, but apparently, the vectors of natural products are called hyperscalaires. It is not difficult to map the natural ones on 2D hyperscalaires and to prove that hyperscalar ones of any dimension are countable and thus mappable bijectively to the natural ones.

More specifically, I am interested in the correspondence of natural with 2D hyperscalar and, to do this, I have defined a hyperscalar sequence. $ a_n $ such as:

  • $ a_0 = (0, 0) $

  • $ a_ {n + 1} = f (a_n) $

or $ f ((a, b)) = (a + 1, max (0, b-1)) $ if $ a + b $ is equal, otherwise $ (max (0, a-1), b + 1) $

If you ask me $ n $– the term of the sequence, it should be calculated recursively, but is there an "algebraic" formula (I can not think of a better term, sorry) that calculates this specific term without necessarily calculating the other?
Although it is a different but connected question, is there an algebraic way to do the opposite (ie to take a hyperscalar method?). $ v $ and return $ n $ such as $ a_n = v $)?