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.

A367844 Triangle read by rows: T(n, k) = (n+5)*n/2 + 1 + (n^2 mod 3) - 3*k for 0 <= k <= n.

Original entry on oeis.org

1, 5, 2, 9, 6, 3, 13, 10, 7, 4, 20, 17, 14, 11, 8, 27, 24, 21, 18, 15, 12, 34, 31, 28, 25, 22, 19, 16, 44, 41, 38, 35, 32, 29, 26, 23, 54, 51, 48, 45, 42, 39, 36, 33, 30, 64, 61, 58, 55, 52, 49, 46, 43, 40, 37, 77, 74, 71, 68, 65, 62, 59, 56, 53, 50, 47, 90, 87, 84, 81, 78, 75, 72, 69, 66, 63, 60, 57
Offset: 0

Views

Author

Werner Schulte, Dec 02 2023

Keywords

Comments

This triangle read by rows yields a permutation of the natural numbers.

Examples

			Triangle T(n, k) for 0 <= k <= n starts:
n\k :    0    1   2   3   4   5   6   7   8   9  10  11  12
===========================================================
 0  :    1
 1  :    5    2
 2  :    9    6   3
 3  :   13   10   7   4
 4  :   20   17  14  11   8
 5  :   27   24  21  18  15  12
 6  :   34   31  28  25  22  19  16
 7  :   44   41  38  35  32  29  26  23
 8  :   54   51  48  45  42  39  36  33  30
 9  :   64   61  58  55  52  49  46  43  40  37
10  :   77   74  71  68  65  62  59  56  53  50  47
11  :   90   87  84  81  78  75  72  69  66  63  60  57
12  :  103  100  97  94  91  88  85  82  79  76  73  70  67
etc.
		

Crossrefs

Programs

  • Maple
    gf := (t^2*x-t*x-t-2)/(3*(t^2+t+1)*(t^2*x^2+t*x+1))+(5*t^2-10*t+8)/(3*(t-1)^3* (t*x-1))+(3*t-2)/((t-1)^2*(t*x-1)^2)+1/((t-1)*(t*x-1)^3):
    sert := series(gf, t, 18): px := n -> simplify(coeff(sert, t, n)):
    row := n -> local k; seq(coeff(px(n), x, k), k = 0..n):
    for n from 0 to 12 do row(n) od;  # Peter Luschny, Dec 02 2023
  • Mathematica
    T[n_, k_]:=(n+5)*n/2+1+Mod [n^2 ,3]-3*k; Table[T[n,k],{n,0,11},{k,0,n}] //Flatten (* Stefano Spezia, Dec 03 2023 *)
  • PARI
    T(n,k) = (n+5)*n/2+1+(n^2%3)-3*k
    
  • Python
    def A367844Row(n):
        Tn0 = (n + 5) * n // 2 + n ** 2 % 3 + 1
        return [Tn0 - k * 3 for k in range(n + 1)]
    for n in range(9): print(A367844Row(n))  # Peter Luschny, Dec 03 2023
    
  • Python
    from math import isqrt, comb
    def A367844(n): return ((a:=(m:=isqrt(k:=n+1<<1))-(k<=m*(m+1)))*(a+5)>>1)+1+a**2%3-3*(n-comb(a+1,2)) # Chai Wah Wu, Nov 12 2024

Formula

T(n, 0) = (n+5)*n/2 + 1 + (n^2 mod 3) for n >= 0.
T(n, n) = (n-1)*n/2 + 1 + (n^2 mod 3) for n >= 0.
T(2*n, n) = 2*n*(n+1) + 1 + (n^2 mod 3) for n >= 0.
T(n, k) - T(n, k+1) = m = 3 for 0 <= k < n (compare with A109857 where m = 2 and with A038722, seen as a triangle, where m = 1).
G.f. of column k = 0: F(t, 0) = Sum_{n>=0} T(n, 0) * t^n = (1 + 3*t - t^3) / ((1 - t^3) * (1 - t)^2).
G.f.: F(t, x) = Sum_{n>=0, k=0..n} T(n, k) * x^k * t^n = (F(t, 0) - x * F(x*t, 0)) / (1 - x) - 3*x*t / ((1 - t) * (1 - x*t)^2).
Row sums are A006003(n+1) + (n^2 mod 3) * (n+1) for n >= 0.