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

A008282 Triangle of Euler-Bernoulli or Entringer numbers read by rows: T(n,k) is the number of down-up permutations of n+1 starting with k+1.

Original entry on oeis.org

1, 1, 1, 1, 2, 2, 2, 4, 5, 5, 5, 10, 14, 16, 16, 16, 32, 46, 56, 61, 61, 61, 122, 178, 224, 256, 272, 272, 272, 544, 800, 1024, 1202, 1324, 1385, 1385, 1385, 2770, 4094, 5296, 6320, 7120, 7664, 7936, 7936, 7936, 15872, 23536, 30656, 36976, 42272, 46366, 49136, 50521, 50521
Offset: 1

Views

Author

Keywords

Examples

			Triangle T(n,k) (with rows n >= 1 and columns k = 1..n) begins
   1
   1  1
   1  2  2
   2  4  5  5
   5 10 14 16 16
  16 32 46 56 61 61
  ...
Each row is constructed by forming the partial sums of the previous row, reading from the right and repeating the final term.
T(4,3) = 5 because we have 41325, 41523, 42314, 42513 and 43512. All these permutations have length n+1 = 5, start with k+1 = 4, and they are down-up permutations.
		

References

  • R. C. Entringer, A combinatorial interpretation of the Euler and Bernoulli numbers, Nieuw Archief voor Wiskunde, 14 (1966), 241-246.

Crossrefs

Programs

  • Haskell
    a008282 n k = a008282_tabl !! (n-1) !! (k-1)
    a008282_row n = a008282_tabl !! (n-1)
    a008282_tabl = iterate f [1] where
       f xs = zs ++ [last zs] where zs = scanl1 (+) (reverse xs)
    -- Reinhard Zumkeller, Dec 28 2011
  • Maple
    f:=series(sec(x)+tan(x),x=0,25): E[0]:=1: for n from 1 to 20 do E[n]:=n!*coeff(f,x^n) od: T:=proc(n,k) if kPeter Luschny, Aug 03 2017
    # Third program:
    T := proc(n, k) local w: if 0 = n mod 2 then w := coeftayl(cos(x)/cos(x + y), [x, y] = [0, 0], [n - k, k]): end if: if 1 = n mod 2 then w := coeftayl(sin(x)/cos(x + y), [x, y] = [0, 0], [k, n - k]): end if: w*(n - k)!*k!: end proc:
    for n from 1 to 6 do seq(T(n,k), k=1..n) od; # Petros Hadjicostas, Feb 17 2021
  • Mathematica
    ro[1] = {1}; ro[n_] := ro[n] = (s = Accumulate[ Reverse[ ro[n-1]]]; Append[ s, Last[s]]); Flatten[ Table[ ro[n], {n, 1, 10}]] (* Jean-François Alcover, Oct 03 2011 *)
    nxt[lst_]:=Module[{lst2=Accumulate[Reverse[lst]]},Flatten[Join[ {lst2,Last[ lst2]}]]]; Flatten[NestList[nxt,{1},10]] (* Harvey P. Dale, Aug 17 2014 *)

Formula

From Emeric Deutsch, May 15 2004: (Start)
Let E[j] = A000111(j) = j! * [x^j](sec(x) + tan(x)) be the up/down or Euler numbers. For 1 <= k < n,
T(n, k) = Sum_{i=0..floor((k-1)/2)} (-1)^i * binomial(k, 2*i+1) * E[n-2*i-1];
T(n,k) = Sum_{i=0..floor((n-k)/2)} (-1)^i * binomial(n-k, 2*i) * E[n-2*i];
T(n, k) = Sum_{i=0..floor((n-k)/2)} (-1)^i * binomial(n-k, 2*i) * E[n-2*i]; and
T(n, n) = E[n] for n >= 1. (End)
From Petros Hadjicostas, Feb 17 2021: (Start)
If n is even, then T(n,k) = k!*(n-k)!*[x^(n-k),y^k] cos(x)/cos(x + y).
If n is odd, then T(n,k) = k!*(n-k)!*[x^k,y^(n-k)] sin(x)/cos(x + y).
(These were adapted and corrected from the formulas in Corollary 1.3 in Foata and Guo-Niu Han (2014).) (End)
Comment from Masanobu Kaneko: (Start)
A generating function that applies for all n, both even and odd:
Sum_{n=0..oo} Sum_{k=0..n} T(n,k) x^(n-k)/(n-k)! * y^k/k! = {cos x + sin y}/cos(x + y).
(End) - N. J. A. Sloane, Feb 06 2022

Extensions

Example and Formula sections edited by Petros Hadjicostas, Feb 17 2021

A099961 Triangle read by rows: Each row is constructed by forming the partial sums of the previous row, reading from the right and at every third row repeating the final term.

Original entry on oeis.org

1, 1, 1, 1, 1, 2, 2, 3, 3, 5, 5, 5, 10, 13, 13, 23, 28, 28, 51, 64, 64, 64, 128, 179, 207, 207, 386, 514, 578, 578, 1092, 1478, 1685, 1685, 1685, 3370, 4848, 5940, 6518, 6518, 12458, 17306, 20676, 22361, 22361, 43037, 60343, 72801, 79319, 79319, 79319
Offset: 0

Views

Author

N. J. A. Sloane, Nov 13 2004

Keywords

Comments

...

Examples

			Triangle begins
   1;
   1,
   1,  1;
   1,  2,
   2,  3,
   3,  5,  5;
   5, 10, 13,
  13, 23, 28,
  28, 51, 64, 64;
		

Crossrefs

First column (and row sums) gives A099962. Cf. A099963, A099967.
If an extra term is added to /every/ row we get A008282. Cf. A099959.

Programs

  • Haskell
    a099961 n k = a099961_tabl !! n !! k
    a099961_row n = a099961_tabl !! n
    a099961_tabl = map snd $ iterate f (0,[1]) where
       f (s,xs) = (s+1, if s `mod` 3 == 1 then zs ++ [last zs] else zs)
         where zs = scanl1 (+) (reverse xs)
    -- Reinhard Zumkeller, Dec 28 2011
  • Maple
    with(linalg):rev:=proc(a) local n, p; n:=vectdim(a): p:=i->a[n+1-i]: vector(n,p) end: ps:=proc(a) local n, q; n:=vectdim(a): q:=i->sum(a[j],j=1..i): vector(n,q) end: pss:=proc(a) local n, q; n:=vectdim(a): q:=proc(i) if i<=n then sum(a[j],j=1..i) else sum(a[j],j=1..n) fi end: vector(n+1,q) end: R[0]:=vector(1,1): for n from 1 to 19 do if n mod 3 = 0 or n mod 3 = 1 then R[n]:=ps(rev(R[n-1])) else R[n]:=pss(rev(R[n-1])) fi od: for n from 0 to 19 do evalm(R[n]) od; # program yields the successive rows # Emeric Deutsch, Nov 16 2004
  • Mathematica
    r[0] = {1}; r[n_] := r[n] = Join[ a = Accumulate[ Reverse[r[n-1]]], If[Mod[n, 3] == 2, {Last[a]}, {}]]; Flatten[ Table[r[n], {n, 0, 15}]](* Jean-François Alcover, Mar 13 2012 *)

Extensions

More terms from Emeric Deutsch, Nov 16 2004

A099960 An interleaving of the Genocchi numbers of the first and second kind, A110501 and A005439.

Original entry on oeis.org

1, 1, 1, 1, 2, 3, 8, 17, 56, 155, 608, 2073, 9440, 38227, 198272, 929569, 5410688, 28820619, 186043904, 1109652905, 7867739648, 51943281731, 401293838336, 2905151042481, 24290513745920, 191329672483963, 1721379917619200, 14655626154768697, 141174819474169856
Offset: 0

Views

Author

N. J. A. Sloane, Nov 13 2004

Keywords

Comments

First column (also row sums) of triangle in A099959.
Number of ascent sequences of length n without level steps and with alternating ascents and descents. a(6) = 8: 010101, 010102, 010103, 010201, 010202, 010203, 010212, 010213. - Alois P. Heinz, Oct 27 2017

References

  • Donald E. Knuth, The Art of Computer Programming, Vol. 4, fascicle 1, section 7.1.4, p. 220, answer to exercise 174, Addison-Wesley, 2009.

Crossrefs

Programs

  • Maple
    with(linalg):rev:=proc(a) local n, p; n:=vectdim(a): p:=i->a[n+1-i]: vector(n,p) end: ps:=proc(a) local n, q; n:=vectdim(a): q:=i->sum(a[j],j=1..i): vector(n,q) end: pss:=proc(a) local n, q; n:=vectdim(a): q:=proc(i) if i<=n then sum(a[j],j=1..i) else sum(a[j],j=1..n) fi end: vector(n+1,q) end: R[0]:=vector(1,1): for n from 1 to 30 do if n mod 2 = 1 then R[n]:=ps(rev(R[n-1])) else R[n]:=pss(rev(R[n-1])) fi od: seq(R[n][1],n=0..30); # Emeric Deutsch
  • Mathematica
    g1 = Table[2*(4^n-1)*BernoulliB[2*n] // Abs, {n, 0, 13}]; g2 = Table[2*(-1)^(n-2)*Sum[Binomial[n, k]*(1-2^(n+k+1))*BernoulliB[n+k+1], {k, 0, n}], {n, 0, 13}]; Riffle[g1, g2] // Rest (* Jean-François Alcover, May 23 2013 *)
  • Sage
    # Algorithm of L. Seidel (1877)
    def A099960_list(n) :
        D = [0]*(n//2+3); D[1] = 1
        R = []; b = True; h = 1
        for i in (1..n) :
            if b :
                for k in range(h,0,-1) : D[k] += D[k+1]
                R.append(D[1]); h += 1
            else :
                for k in range(1,h, 1) : D[k] += D[k-1]
                R.append(D[h-1])
            b = not b
        return R
    A099960_list(27)  # Peter Luschny, Apr 30 2012

Formula

a(n) ~ 2^(5/2) * n^(n+3/2) / (Pi^(n+1/2) * exp(n)). - Vaclav Kotesovec, Sep 10 2014

Extensions

More terms from Emeric Deutsch, Nov 16 2004

A099964 Triangle read by rows: The n-th row is constructed by forming the partial sums of the previous row, reading from the right and if n is a triangular number repeating the final term.

Original entry on oeis.org

1, 1, 1, 1, 2, 2, 3, 3, 3, 6, 8, 8, 14, 17, 17, 31, 39, 39, 39, 78, 109, 126, 126, 235, 313, 352, 352, 665, 900, 1026, 1026, 1926, 2591, 2943, 2943, 2943, 5886, 8477, 10403, 11429, 11429, 21832, 30309, 36195, 39138, 39138, 75333, 105642, 127474, 138903
Offset: 0

Views

Author

N. J. A. Sloane, Nov 13 2004

Keywords

Comments

...

Examples

			Triangle begins
     1;
     1,    1;
     1,    2,
     2,    3,    3;
     3,    6,    8,
     8,   14,   17,
    17,   31,   39,   39;
    39,   78,  109,  126,
   126,  235,  313,  352,
   352,  665,  900, 1026,
  1026, 1926, 2591, 2943, 2943;
		

Crossrefs

First column (and row sums) gives A099965. Cf. A099966, A099968.
If an extra term is added to /every/ row we get A008282. Cf. A099959, A099961.
Cf. A010054.

Programs

  • Haskell
    a099964 n k = a099964_tabf !! n !! k
    a099964_row n = a099964_tabf !! n
    a099964_tabf = scanl f [1] $ tail a010054_list where
       f row t = if t == 1 then row' ++ [last row'] else row'
               where row' = scanl1 (+) $ reverse row
    -- Reinhard Zumkeller, May 02 2012
  • Maple
    with(linalg):rev:=proc(a) local n, p; n:=vectdim(a): p:=i->a[n+1-i]: vector(n,p) end: ps:=proc(a) local n, q; n:=vectdim(a): q:=i->sum(a[j],j=1..i): vector(n,q) end: pss:=proc(a) local n, q; n:=vectdim(a): q:=proc(i) if i<=n then sum(a[j],j=1..i) else sum(a[j],j=1..n) fi end: vector(n+1,q) end: tr:={seq(n*(n+1)/2,n=1..30)}: R[0]:=vector(1,1): for n from 1 to 15 do if member(n,tr)=false then R[n]:=ps(rev(R[n-1])) else R[n]:=pss(rev(R[n-1])) fi od: for n from 0 to 15 do evalm(R[n]) od; # Emeric Deutsch, Nov 16 2004
  • Mathematica
    triQ[n_] := Reduce[ n == k(k+1)/2, k, Integers] =!= False; row[0] = {1}; row[1] = {1, 1}; row[n_] := row[n] = (ro = Accumulate[ Reverse[ row[n-1]]]; If[triQ[n], Append[ ro, Last[ro] ], ro]); Flatten[ Table[ row[n], {n, 0, 13}]](* Jean-François Alcover, Nov 24 2011 *)

Extensions

More terms from Emeric Deutsch, Nov 16 2004

A297703 The Genocchi triangle read by rows, T(n,k) for n>=0 and 0<=k<=n.

Original entry on oeis.org

1, 1, 1, 2, 3, 3, 8, 14, 17, 17, 56, 104, 138, 155, 155, 608, 1160, 1608, 1918, 2073, 2073, 9440, 18272, 25944, 32008, 36154, 38227, 38227, 198272, 387104, 557664, 702280, 814888, 891342, 929569, 929569, 5410688, 10623104, 15448416, 19716064, 23281432, 26031912
Offset: 0

Views

Author

Peter Luschny, Jan 03 2018

Keywords

Examples

			The triangle starts:
0: [     1]
1: [     1,      1]
2: [     2,      3,      3]
3: [     8,     14,     17,     17]
4: [    56,    104,    138,    155,    155]
5: [   608,   1160,   1608,   1918,   2073,   2073]
6: [  9440,  18272,  25944,  32008,  36154,  38227,  38227]
7: [198272, 387104, 557664, 702280, 814888, 891342, 929569, 929569]
		

Crossrefs

Row sums are A005439 with offset 0.
T(n,0) = A005439 with A005439(0) = 1.
T(n,n) = A110501 with offset 0.

Programs

  • Julia
    function A297703Triangle(len::Int)
        A = fill(BigInt(0), len+2); A[2] = 1
        for n in 2:len+1
            for k in n:-1:2 A[k] += A[k+1] end
            for k in 2: 1:n A[k] += A[k-1] end
            println(A[2:n])
        end
    end
    println(A297703Triangle(9))
    
  • Python
    from functools import cache
    @cache
    def T(n):  # returns row n
        if n == 0: return [1]
        row = [0] + T(n - 1) + [0]
        for k in range(n, 0, -1): row[k] += row[k + 1]
        for k in range(2, n + 2): row[k] += row[k - 1]
        return row[1:]
    for n in range(9): print(T(n))  # Peter Luschny, Jun 03 2022
Showing 1-5 of 5 results.