cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A269783 Starting with a(0) = 0, the subsequence of immediate successors of the instances of each integer n in the sequence is n, n-1, n+1, n-2, n+2, ... for n > 0 and n, n+1, n-1, n+2, n-2, ... for n <= 0.

Original entry on oeis.org

0, 0, 1, 1, 0, -1, -1, 0, 2, 2, 1, 2, 3, 3, 2, 0, -2, -2, -1, -2, -3, -3, -2, 0, 3, 4, 4, 3, 1, -1, 1, 3, 5, 5, 4, 5, 6, 6, 5, 3, 0, -3, -4, -4, -3, -1, -3, -5, -5, -4, -5, -6, -6, -5, -3, 0, 4, 2, 4, 6, 7, 7, 6, 4, 1, -2, -4, -2, 1, 4
Offset: 0

Views

Author

Keywords

Comments

Note that "subsequence" refers to any sequence of values taken at increasing indices in the base sequence, not necessarily consecutive terms.
In more detail, for any integer n, let i(k) be the index of the k-th occurrence of n in this sequence, i.e., { i(1), i(2), i(3), ...} = { i | a(i) = n }. Then S(n) := (a(i(1)+1), a(i(2)+1), a(i(3)+1), ...) = (n, n-1, n+1, n-2, ...) if n > 0 and S(n) = (n, n+1, n-1, n+2, ...) if n <= 0. This property, together with the choice if the starting value a(0) = 0, uniquely defines the sequence, because it unambiguously defines the successor of any given term. - M. F. Hasler, Mar 07 2016
Every ordered pair of integers occurs exactly once in this sequence.
Indeed, given any pair (n,m), there is a unique k such that m-n = (-1)^(k-[n>0])*floor(k/2), and by definition the pair (n,m) occurs exactly at the k-th occurrence of n. It remains to show that all integers occur infinitely often. - M. F. Hasler, Mar 07 2016

Examples

			a(0) is 0. As a(0) is the first 0 in the sequence, a(1) is the first term in the sequence 0, 1, -1, 2, -2 (incidently A001057, but ignoring the offset of that sequence), nameley 0. Now a(1) is the second 0, so we take the second term in A001057, and a(2) = 1. For the first 1, we take the first term associated with 1, which is 1, and a(3) = 1. Now we have the second 1, we take the second term of 1, 0, 2, -1, ..., which is again 0.
Table of indices where the pairs (i,j) start in the sequence:
    i \ j  -3   -2   -1   0    1    2    3
   ...    ...  ...  ...  ...  ...  ...  ...
   -3 ...  20   21   44   54  129  326  558  ...
   -2 ...  19   16   17   22   67  200  374  ...
   -1 ...  45   18    5    6   29   92  169  ...
    0 ...  40   15    4   (0)   1    7   23  ...
    1 ... 124   64   28    3    2   10   30  ...
    2 ... 325  199   93   14    9    8   11  ...
    3 ... 557  373  170   39   27   13   12  ...
   ...    ...  ...  ...  ...  ...  ...  ...
extending in all directions. The table always fills in faster on the top-left to bottom-right diagonal, so it grows faster on the other diagonal.
		

Crossrefs

Programs

  • PARI
    A269783(n,show=0,a=0,C=[])={for(n=1,n,show&&print1(a",");i=setsearch(C,[a,0],1);(i>#C || C[i][1] != a) && C=setunion(C,[[a,0]]); a+=(-1)^((a>0)+C[i][2]+=1)*(C[i][2]\2));a} \\ Set 2nd (optional) arg to 1 to print out all terms, 3rd arg to change starting value. Change "for(n=1...);a" to "vector(n...)" to return the vector of values. - M. F. Hasler, Mar 07 2016

Formula

The immediate successor of any term a(j) = n is a(j+1) = n + (-1)^(k-e) * floor(k/2), where k = # { i <= j | a(i) = n } (meaning that a(j) is the k-th occurrence of n in the sequence), and e := [n>0] = (1 if n > 0 and 0 if n <= 0). - M. F. Hasler, Mar 07 2016