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.

Showing 1-4 of 4 results.

A269780 Table read by antidiagonals where T(i,j) is the location of the pair (i,j) in A269501.

Original entry on oeis.org

1, 2, 4, 5, 3, 9, 10, 8, 7, 16, 17, 15, 6, 14, 25, 26, 24, 13, 12, 23, 36, 37, 35, 22, 11, 21, 34, 49, 50, 48, 33, 20, 19, 32, 47, 64, 65, 63, 46, 31, 18, 30, 45, 62, 81, 82, 80, 61, 44, 29, 28, 43, 60, 79, 100, 101, 99, 78, 59, 42, 27, 41, 58, 77, 98, 121, 122, 120, 97, 76, 57, 40, 39, 56, 75, 96, 119, 144
Offset: 1

Views

Author

Keywords

Comments

This is trivially a permutation of the positive integers.
The "location" of the pair is taken to be the index of the second element of the pair.

Examples

			The table starts:
   1,  2,  5, 10, 17, 26
   4,  3,  8, 15, 24, 35
   9,  7,  6, 13, 22, 33
  16, 14, 12, 11, 20, 31
  25, 23, 21, 19, 18, 29
  36, 34, 32, 30, 28, 27
		

Crossrefs

Cf. A269501, A097292, A002522 (top row, left shifted).
If 1 is subtracted from each term we get A316323.

Formula

T(i,j) :=
if i=1, then (j-1)^2 + 1,
if i>j, then i^2 - 2j + 2,
and otherwise j^2 - 2i + 3.

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

A305615 Next term is the largest earlier term that would not create a repetition of an earlier subsequence of length 2, if such a number exists; otherwise it is the smallest nonnegative number not yet in the sequence.

Original entry on oeis.org

0, 0, 1, 1, 0, 2, 2, 1, 2, 0, 3, 3, 2, 3, 1, 3, 0, 4, 4, 3, 4, 2, 4, 1, 4, 0, 5, 5, 4, 5, 3, 5, 2, 5, 1, 5, 0, 6, 6, 5, 6, 4, 6, 3, 6, 2, 6, 1, 6, 0, 7, 7, 6, 7, 5, 7, 4, 7, 3, 7, 2, 7, 1, 7, 0, 8, 8, 7, 8, 6, 8, 5, 8, 4, 8, 3, 8, 2, 8, 1, 8, 0, 9, 9, 8, 9, 7, 9, 6, 9, 5, 9, 4, 9, 3, 9, 2, 9, 1, 9, 0
Offset: 0

Views

Author

Luc Rousseau, Jun 06 2018

Keywords

Comments

The map n |-> (a(n), a(n+1)) is a bijection between N and N X N: when drawn in a 2D array, this map makes progress by finishing the filling of a square gnomon before starting to fill the next one. This and the predictable zigzag way each gnomon is filled make it possible to deduce a closed formula for a(n).
A269501 is an essentially identical sequence: a(n) = A269501(n)-1. - N. J. A. Sloane, Jul 03 2018
For n > 3 indices for values = 1 are A008865(m), m > 2. - Bill McEachen, Oct 26 2023

Examples

			a(0): no already-used value exists, so one has to take the least nonnegative integer, so a(0) = 0;
a(1): reusing 0 is legal, so a(1) = 0. Repeating (0, 0) now becomes illegal;
a(2): reusing 0 is illegal since (a(1), a(2)) would repeat (0, 0). The smallest unused value is 1, so a(2) = 1. Repeating (0, 1) becomes illegal;
a(3): reusing 1 is legal. a(3) = 1. Repeating (1, 1) becomes illegal;
a(4): reusing 1 is illegal (would repeat (1, 1)) but reusing 0 is legal. a(4) = 0. Repeating (1, 0) becomes illegal;
and so on.
a(n) is also the x-coordinate of the cell that contains n in the following 2D infinite array:
  y
  ^
  |
  4 |... ... ... ... ...
    +---------------+
  3 | 9  14  12  10 |...
    +-----------+   |
  2 | 4   7   5 |11 |...
    +-------+   |   |
  1 | 1   2 | 6 |13 |...
    +---+   |   |   |
  0 | 0 | 3 | 8 |15 |...
    +---+---+---+---+---
      0   1   2   3   4 --->x
		

Crossrefs

For the 2D array shown in the EXAMPLE section, see A316323 and A269780. - N. J. A. Sloane, Jul 03 2018

Programs

  • Mathematica
    A[n_] := Module[{k, t}, k = Floor[Sqrt[n]]; t = n - k^2;
      Boole[t != 0]*k - Boole[OddQ[t]]*(t - 1)/2]; Table[A[n], {n, 0, 100}]
  • PARI
    a(n)=k=floor(sqrt(n));t=n-k^2;(t!=0)*k-(t%2)*(t-1)/2
    for(n=0,100,print1(a(n),", "))
  • Prolog
    main :- a(100, A, , ), reverse(A, R), writeln(R).
    a(0, [0], [0], []) :- !.
    a(N, A, V, P) :-
      M is N - 1, a(M, AA, VV, PP), AA = [AM | _],
      findall(L, (member(L, VV), not(member([AM, L], PP))), Ls),
      (Ls = [L | _] -> V = VV ; (length(VV, L), V = [L | VV])),
      A = [L | AA], P = [[AM, L] | PP].
    

Formula

a(n) = [t!=0]*k-[t is odd]*(t-1)/2, where k = floor(sqrt(n)), t = n-k^2 and [] stands for the Iverson bracket.

A316323 The square array in A305615 read by antidiagonals.

Original entry on oeis.org

0, 1, 3, 4, 2, 8, 9, 7, 6, 15, 16, 14, 5, 13, 24, 25, 23, 12, 11, 22, 35, 36, 34, 21, 10, 20, 33, 48, 49, 47, 32, 19, 18, 31, 46, 63, 64, 62, 45, 30, 17, 29, 44, 61, 80, 81, 79, 60, 43, 28, 27, 42, 59, 78, 99, 100, 98, 77, 58, 41, 26, 40, 57, 76, 97, 120, 121, 119, 96, 75, 56, 39, 38, 55, 74, 95, 118, 143
Offset: 0

Views

Author

N. J. A. Sloane, Jul 03 2018

Keywords

Examples

			The array in A305615 begins:
  ^
  |
  4 |... ... ... ... ...
    +---------------+
  3 | 9  14  12  10 |...
    +-----------+   |
  2 | 4   7   5 |11 |...
    +-------+   |   |
  1 | 1   2 | 6 |13 |...
    +---+   |   |   |
  0 | 0 | 3 | 8 |15 |...
    +---+---+---+---+---
      0   1   2   3   4 ...
The first few antidiagonals are:L
0,
1, 3,
4, 2, 8,
9, 7, 6, 15,
16, 14, 5, 13, 24,
25, 23, 12, 11, 22, 35,
36, 34, 21, 10, 20, 33, 48,
...
		

Crossrefs

Formula

If 1 is added to every term we get the array in A269780, which has an explicit formula for the (i,j)-th term.
Showing 1-4 of 4 results.