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.

A176305 Triangle T(n,k) = 1 -A002627(k) -A002627(n-k) +A002627(n), read by rows.

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 1, 7, 7, 1, 1, 31, 36, 31, 1, 1, 165, 194, 194, 165, 1, 1, 1031, 1194, 1218, 1194, 1031, 1, 1, 7423, 8452, 8610, 8610, 8452, 7423, 1, 1, 60621, 68042, 69066, 69200, 69066, 68042, 60621, 1, 1, 554249, 614868, 622284, 623284, 623284, 622284, 614868, 554249, 1
Offset: 0

Views

Author

Roger L. Bagula, Apr 14 2010

Keywords

Comments

Row sums are {1, 2, 4, 16, 100, 720, 5670, 48972, 464660, 4829372, 54711782, ...}.
Row sums s(n) appear to obey (2-n)*s(n) +(n+2)*(n-1)*s(n-2) -n*(2*n-1)*s(n-2) +n*(n-2)*s(n-3)=0. - R. J. Mathar, May 04 2013

Examples

			Triangle begins as:
  1;
  1,      1;
  1,      2,      1;
  1,      7,      7,      1;
  1,     31,     36,     31,      1;
  1,    165,    194,    194,    165,      1;
  1,   1031,   1194,   1218,   1194,   1031,      1;
  1,   7423,   8452,   8610,   8610,   8452,   7423,      1;
  1,  60621,  68042,  69066,  69200,  69066,  68042,  60621,      1;
  1, 554249, 614868, 622284, 623284, 623284, 622284, 614868, 554249, 1;
		

Programs

  • Magma
    b:= func< n | Factorial(n)*(Exp(1)-1)>;
    function T(n,k)
      if k eq 0 or k eq n then return 1;
      else return 1 +Floor(b(n)) -Floor(b(k)) -Floor(b(n-k));
      end if; return T; end function;
    [T(n,k): k in [0..n], n in [0..10]]; // G. C. Greubel, Nov 26 2019
    
  • Maple
    T:= proc(n, k) option remember;
          if k=0 or k=n then 1
        else 1 +floor(n!*(exp(1)-1)) -floor(k!*(exp(1)-1)) -floor((n-k)!*(exp(1)-1))
          fi; end:
    seq(seq(T(n, k), k=0..n), n=0..10); # G. C. Greubel, Nov 26 2019
  • Mathematica
    (* First program *)
    a[n_]:= a[n] = If[n==0,0,n*a[n-1] +1];
    T[n_, k_]:= T[n, k] = 1 -(a[k] +a[n-k] -a[n]);
    Table[T[n, k], {n,0,10}, {k,0,n}]//Flatten
    (* Second program *)
    T[n_, k_]:= T[n, k]= If[k==0 || k==n, 1, 1 +Floor[n!*(E-1)] -Floor[k!*(E-1)] - Floor[(n-k)!*(E-1)]]; Table[T[n, k], {n,0,10}, {k,0,n}]//Flatten (* G. C. Greubel, Nov 26 2019 *)
  • PARI
    T(n,k) = if(k==0 || k==n, 1, 1 +floor(n!*(exp(1)-1)) -floor(k!*(exp(1)-1)) -floor((n-k)!*(exp(1)-1)) ); \\ G. C. Greubel, Nov 26 2019
    
  • Sage
    @CachedFunction
    def b(n): return factorial(n)*(exp(1)-1);
    def T(n, k):
        if (k==0 or k==n): return 1
        else: return 1 +floor(b(n)) -floor(b(k)) -floor(b(n-k))
    [[T(n, k) for k in (0..n)] for n in (0..10)] # G. C. Greubel, Nov 26 2019

Formula

T(n,k) = T(n,n-k).