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-3 of 3 results.

A288969 Triangular array read by rows: row n is the list of the 2*n-1 successive values taken by the function z = n - floor(x) * floor(y) along the hyperbola with equation y = n/x, for 1 <= x <= n.

Original entry on oeis.org

0, 0, 1, 0, 0, 1, 2, 1, 0, 0, 1, 2, 0, 2, 1, 0, 0, 1, 2, 3, 1, 3, 2, 1, 0, 0, 1, 2, 3, 0, 2, 0, 3, 2, 1, 0, 0, 1, 2, 3, 4, 1, 3, 1, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 0, 2, 4, 2, 0, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 1, 3, 0, 3, 1, 5, 4, 3, 2, 1, 0
Offset: 1

Views

Author

Luc Rousseau, Jun 20 2017

Keywords

Comments

See A288966's links for explanations about the algorithm used to go along an hyperbola of equation y = n/x, with 1 <= x <= n.
When represented as a triangular array, internal zeros "0" correspond to factorizations of n.
This array appears to resemble a version of the sieve of Eratosthenes with zeros aligned.
A053186 and A293497 appear to intertwine into this sequence. The following will be denoted "assumption (1)": with t indexing columns, t=0 being central: T(n, 2k) = A053186(n+k^2) and T(n, 2k+1) = A293497(n+k(k+1)). - Luc Rousseau, Oct 11 2017
It would be nice to have a larger b-file, or an a-file. - N. J. A. Sloane, Oct 13 2017

Examples

			Array begins:
                0
              0 1 0
            0 1 2 1 0
          0 1 2 0 2 1 0
        0 1 2 3 1 3 2 1 0
      0 1 2 3 0 2 0 3 2 1 0
    0 1 2 3 4 1 3 1 4 3 2 1 0
  0 1 2 3 4 0 2 4 2 0 4 3 2 1 0
		

Crossrefs

Programs

  • Java
    package oeis;
    public class B {
    public static void main(String[] args) {
    for (int n = 1; n <= 8; n ++) {
    hyberbolaTiles(n);
    }
    }
    private static void hyberbolaTiles(int n) {
    int x = 0, y = 0, p = 0, q = n;
    do {
    if (p != 0) {
    System.out.println(n - p * q);
    }
    if (y < 0) { x = y + q; q --; }
    if (y > 0) { p ++; x = y - p; }
    if (y == 0) {
    p ++;
    x = 0; System.out.println("0");
    q --;
    }
    y = x + p - q;
    } while (q > 0);
    }
    }
    
  • Mathematica
    (* Under assumption (1) *)
    A288969[n_, t_] := Module[{x},
      x = Floor[(-t + Sqrt[t^2 + 4 n])/2];
      n - x (t + x)
    ] (* Luc Rousseau, Oct 11 2017 *)
    (* or *)
    FEven[x_] := x^ 2
    InvFEven[x_] := Sqrt[x]
    GEven[n_] := n - FEven[Floor[InvFEven[n]]]
    FOdd[x_] := x*(x + 1)
    InvFOdd[x_] := (Sqrt[1 + 4 x] - 1)/2
    GOdd[n_] := n - FOdd[Floor[InvFOdd[n]]]
    A288969[n_, t_] := Module[
      {e, k, x},
      e = EvenQ[t];
      k = If[e, t/2, (t - 1)/2];
      x = n + If[e, FEven[k], FOdd[k]];
      If[e, GEven[x], GOdd[x]]
    ] (* Luc Rousseau, Oct 11 2017 *)
  • PARI
    htrow(n) = {my(x = 0, y = 0, p = 0, q = n); while (q>0, if (p, print1(n-p*q, ", ")); if (y < 0, x = y + q; q --); if (y > 0, p ++; x = y - p); if (y == 0, p++; x = 0; print1(0, ", "); q --;); y = x + p - q;);}
    tabf(nn) = for (n=1, nn, htrow(n); print()); \\ Michel Marcus, Jun 21 2017

Formula

From Luc Rousseau, Oct 11 2017: (Start)
(All formulas under assumption (1))
With t indexing columns, t=0 being central,
T(n, 2k) = A053186(n+k^2).
T(n, 2k+1) = A293497(n+k(k+1)).
T(n, t) = n - x*(x+t) where x = floor((-t+sqrt(t^2+4n))/2).
With A293578 viewed as a 2D array T',
T'(n,t)=T(n-1,t)-T(n,t)+1 (define T(0,0) as 0).
(End)

Extensions

More terms from Michel Marcus, Jun 21 2017

A293670 Square array made of (W, N, S, E) quadruplets read by antidiagonals. Numeric structure of an anamorphosis of A002024 (see comments).

Original entry on oeis.org

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

Views

Author

Luc Rousseau, Oct 14 2017

Keywords

Comments

Numeric characterization:
Row n is the value of a list after n iterations of the following algorithm:
- start with an empty list (assimilable to row number 0)
- Iteration n consists of
-- if n is odd, appending 1 to the left of the list and -1 to the right;
-- if n is even, replacing each value in the list by its complement to n/2.
Underlying definition and interest: this sequence represents a square array in which each cell is a structure made of 4 values arranged in W/N/S/E fashion. These values are twice the areas of elementary right triangles that enter the composition of quadrilaterals delimited by two families of lines, with the following equations:
- for m = 1, 2, 3, ...: y = mx - (m-1)^2 {x <= m-1}
- for n = -1, 0, 1, ...: y = -nx - (n+1)^2 {x >= 1-n}
Globally these quadrilaterals form an anamorphosis of A002024. See provided link for explanations and illustrations.

Examples

			Array begins (characterization)(x stands for -1):
              1 x
              0 2
            1 0 2 x
            1 2 0 3
          1 1 2 0 3 x
          2 2 1 3 0 4
        1 2 2 1 3 0 4 x
        3 2 2 3 1 4 0 5
      1 3 2 2 3 1 4 0 5 x
      4 2 3 3 2 4 1 5 0 6
    1 4 2 3 3 2 4 1 5 0 6 x
    5 2 4 3 3 4 2 5 1 6 0 7
  1 5 2 4 3 3 4 2 5 1 6 0 7 x
Or (definition)(to be read by antidiagonals):
    x     x     x     x
  1   2 2   3 3   4 4   5 ...
    0     0     0     0
    0     0     0     0
  1   2 2   3 3   4 4   5 ...
    1     1     1     1
    1     1     1     1
  1   2 2   3 3   4 4   5 ...
    2     2     2     2
    2     2     2     2
  1   2 2   3 3   4 4   5 ...
    3     3     3     3
    3     3     3     3
  1   2 2   3 3   4 4   5 ...
    4     4     4     4
  ...
		

Crossrefs

Programs

  • PARI
    evolve(L,n)=if(n%2==1,listinsert(L,1,1);listinsert(L,-1,#L+1),L=apply(v->n/2-v,L));L
    N=30;L=List();for(n=1,N,L=evolve(L,n);for(i=1,#L,print1(L[i],", "));print())

A290691 Triangle read by rows: infinite braid made of periodically-colored yarns in which the crossing of two adjacent yarns occurs when two color 0's are side by side (see comments).

Original entry on oeis.org

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

Views

Author

Luc Rousseau, Oct 20 2017

Keywords

Comments

Construction: row numbers start at n = 3; column numbers run from k = 1 to k = n - 2. For all y >= 2, a yarn called "yarn y" is made of the repeated (y - 1, y - 2, ..., 1, 0) sequence. Pin it (for now vertically) at coordinates (y + 1, y - 1). Progress by increasing n: for a given row n, if two adjacent yarns show side by side 0's, then cross them at this point.
Properties: n is a prime iff there is no 0 in row n. n is a square iff there is an isolated 0 in row n column 1. If there is a crossing between yarn y1 and yarn y2 in row n, then n = y1 * y2.
Alternative definition: row n is the list of (-n) mod (y) sorted in ascending order of abs(y - n / y), for all y candidate divisor of n, y between 2 and (n - 1) inclusive.

Examples

			Array begins:
1
0  2
1  1  3
0  0  2  4
2  1  1  3  5
1  0  0  2  4  6
0  3  1  1  3  5  7
2  2  0  0  2  4  6  8
1  1  4  1  1  3  5  7  9
...
Viewed as a braid (pairs of adjacent zeros being replaced by crossings):
        1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  ------> k
      .
   3    1
        |
   4    0   2
        |   |
   5    1   1   3
         \ /    |
   6      0     2   4
         / \    |   |
   7    2   1   1   3   5
        |    \ /    |   |
   8    1     0     2   4   6
        |    / \    |   |   |
   9    0   3   1   1   3   5   7
        |   |    \ /    |   |   |
  10    2   2     0     2   4   6   8
        |   |    / \    |   |   |   |
  11    1   1   4   1   1   3   5   7   9
         \ /    |    \ /    |   |   |   |
  12      0     3     0     2   4   6   8  10
         / \    |    / \    |   |   |   |   |
  13    3   2   2   5   1   1   3   5   7   9  11
        |   |   |   |    \ /    |   |   |   |   |
  14    2   1   1   4     0     2   4   6   8  10  12
        |    \ /    |    / \    |   |   |   |   |   |
  15    1     0     3   6   1   1   3   5   7   9  11  13
        |    / \    |   |    \ /    |   |   |   |   |   |
  16    0   4   2   2   5     0     2   4   6   8  10  12  14
        |   |   |   |   |    / \    |   |   |   |   |   |   |
  17    3   3   1   1   4   7   1   1   3   5   7   9  11  13  15
   |
   V   ...
   n
		

Crossrefs

Cf. A293578.

Programs

  • C
    #include 
    #include 
    #include 
    #define NMAX 40
    struct cell { int f; int v; };
    struct line { struct cell t[NMAX]; };
    void display(struct line *T) { int n, k; for (n = 3; n <= NMAX; n ++) { for (k = 1; k < n - 1; k ++) { printf("%2d, ", T[n].t[k].v, T[n].t[k].f); } printf("\n"); } }
    void swap(int *a, int *b) { int x; x = *a; *a = *b; *b = x; }
    void fill(struct line *T)
    {
        int n, k;
        for (n = 3; n <= NMAX; n ++)
        {
            for (k = 1; k < n - 2; k ++)
            {
                T[n].t[k].v = T[n - 1].t[k].v - 1;
                T[n].t[k].f = T[n - 1].t[k].f;
            }
            T[n].t[n - 2].v = n - 2;
            T[n].t[n - 2].f = n - 1;
            for (k = 1; k < n - 2; k ++)
            {
                if ((T[n].t[k].v == 0) && (T[n].t[k + 1].v == 0))
                {
                    swap(&T[n].t[k].f, &T[n].t[k + 1].f);
                }
            }
            for (k = 1; k < n - 2; k ++)
            {
                if (T[n].t[k].v == -1)
                {
                    T[n].t[k].v += T[n].t[k].f;
                }
            }
        }
    }
    int main() { struct line T[NMAX + 1]; memset(T, 0x0, sizeof(T)); fill(T); display(T); }
  • Mathematica
    Ev[E_] := Module[{x, dx}, x = First[E]; dx = Last[E]; If[x == 0 && dx < 0, {-dx, -dx}, {x + dx, dx}]]
    EvL[n_, L_] := Module[{LL}, LL = Ev /@ L; LL = Sort[LL]; LL = Append[LL, {n - 1, -1/n}]; LL]
    It[nStart_, nEnd_, LStart_] := Module[{n, LL}, For[n = nStart; LL = LStart, n <= nEnd, n++, LL = EvL[n, LL]]; LL]
    Encours[n_] := It[2, n, {}]
    Countdown[x_, dx_] := If[dx > 0, (Ceiling[x] - x)/dx, (Floor[x] - x)/dx]
    A[n_] := Drop[Apply[Countdown, #] & /@ Encours[n], -1]
    Table[A[n], {n, 2, 25}] // Flatten
    (* or *)
    (Last /@ # &) /@ Sort /@ Table[{Abs[k - n/k], Mod[-n, k]}, {n, 3, 20}, {k, 2, n - 1}] // Flatten

Formula

T(n,k) = (-n) mod y(n,k), with y(n,k) the yarn going through (n,k); ambiguity at a crossing doesn't matter, both mod yielding 0.
Showing 1-3 of 3 results.