0
$\begingroup$

I can't find much on the internet about this, but apparently vectors of naturals are called hyperscalars. It's not hard to bijectively map naturals to 2D hyperscalars and with that to prove that any-dimensional hyperscalars are countable and thus bijectively mappable to naturals.

More specifically, I'm interested in mapping naturals to 2D hyperscalars, and to do so I've defined a hyperscalar sequence $a_n$ such that:

  • $a_0 = (0, 0)$

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

where $f((a,b)) = (a+1, max(0,b-1))$ if $a+b$ is even, else $(max(0,a-1),b+1)$

If I'm asked the $n$-th term of the sequence I'd have to compute it recursively, but is there an "algebraic" (can't seem to think of a better term, sorry) formula that computes that specific term without necessarily computing the others? Although a different, but related, question, is there an algebraic way to do the opposite (i.e. take a hyperscalar $v$ and return $n$ such as $a_n = v$)?

$\endgroup$
1
  • $\begingroup$ Compute the pre-image of the points (a,0), then count backwards along the diagonal. $\endgroup$ Commented Apr 11, 2019 at 12:08

1 Answer 1

0
$\begingroup$

$$a_n=\{Y_n,X_n\}$$

where $X_n$ is sequence A319572 and $Y_n$ is sequence A319573 in the OEIS database. These are the coordinates of the stripe enumeration of $N \times N$ where $N = \{0, 1, 2, \ldots\}$. A "Stripe Enumeration" function to produce these sequences is provided here.

Here is some Mathematica code to test for this:

f[{a_, b_}] := (1/2)*(1 - (-1)^(a + b))*{Max[0, a - 1], 
b + 1} + (1/2)*(1 + (-1)^(a + b))*{a + 1, Max[0, b - 1]}

RecurrenceTable[{a[n + 1] == f[a[n]], a[0] == {0, 0}}, a, {n, 0, 30}]

The output for $a_n$ is

{{0, 0}, {1, 0}, {0, 1}, {0, 2}, {1, 1}, {2, 0}, {3, 0}, {2, 1}, {1, 2}, {0, 3}, {0, 4}, {1, 3}, {2, 2}, {3, 1}, {4, 0}, {5, 0}, {4, 1}, {3, 2}, {2, 3}, {1, 4}, {0, 5}, {0, 6}, {1, 5}, {2, 4}, {3, 3}, {4, 2}, {5, 1}, {6, 0}, {7, 0}, {6, 1}, {5, 2}}

Compare with

$$Y_n=0, 1, 0, 0, 1, 2, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 6, 5$$ $$X_n=0, 0, 1, 2, 1, 0, 0, 1, 2, 3, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2$$

$\endgroup$
1
  • $\begingroup$ Awesome, exactly what I needed. As a side note, do you happen to know the name for the sequence that maps N to ZxZ and N to QxQ? $\endgroup$
    – Leodip
    Commented Apr 11, 2019 at 10:43

Not the answer you're looking for? Browse other questions tagged .