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.

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