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

A276312 Number of up-down sequences of length n and values in {1,2,...,n}.

Original entry on oeis.org

1, 1, 1, 5, 31, 246, 2353, 26585, 345775, 5094220, 83833256, 1524414737, 30353430420, 656851828075, 15350023574061, 385261255931365, 10335781852020335, 295166535640444376, 8939894824857438940, 286234265613041061128, 9659753724363828753408
Offset: 0

Views

Author

Alois P. Heinz, Aug 29 2016

Keywords

Examples

			a(0) = 1: the empty sequence.
a(1) = 1: 1.
a(2) = 1: 12.
a(3) = 5: 121, 131, 132, 231, 232.
a(4) = 31: 1212, 1213, 1214, 1312, 1313, 1314, 1323, 1324, 1412, 1413, 1414, 1423, 1424, 1434, 2312, 2313, 2314, 2323, 2324, 2412, 2413, 2414, 2423, 2424, 2434, 3412, 3413, 3414, 3423, 3424, 3434.
		

Crossrefs

A diagonal of A050446, A050447.
Cf. A276313.

Programs

  • Maple
    b:= proc(n, k, t) option remember; `if`(n=0, 1,
          add(b(n-1, k, k-j), j=1..t-1))
        end:
    a:= n-> b(n, n+1$2):
    seq(a(n), n=0..25);
  • Mathematica
    b[n_, k_, t_] := b[n, k, t] = If[n==0, 1, Sum[b[n-1, k, k-j], {j, 1, t-1}]];
    a[n_] := b[n, n+1, n+1];
    a /@ Range[0, 25] (* Jean-François Alcover, Dec 29 2020, after Alois P. Heinz *)

Formula

a(n) ~ exp(-1/2) * 2^(n+2) * n^n / Pi^(n+1). - Vaclav Kotesovec, Aug 30 2016

A373424 Array read by ascending antidiagonals: T(n, k) = [x^k] cf(n) where cf(n) is the continued fraction (-1)^n/(~x - 1/(~x - ... 1/(~x - 1)))...) and where '~' is '-' if n is even, and '+' if n is odd, and x appears n times in the expression.

Original entry on oeis.org

1, 1, 0, 1, 1, 0, 1, 2, 1, 0, 1, 3, 3, 1, 0, 1, 4, 6, 5, 1, 0, 1, 5, 10, 14, 8, 1, 0, 1, 6, 15, 30, 31, 13, 1, 0, 1, 7, 21, 55, 85, 70, 21, 1, 0, 1, 8, 28, 91, 190, 246, 157, 34, 1, 0, 1, 9, 36, 140, 371, 671, 707, 353, 55, 1, 0, 1, 10, 45, 204, 658, 1547, 2353, 2037, 793, 89, 1, 0
Offset: 0

Views

Author

Peter Luschny, Jun 09 2024

Keywords

Comments

A variant of both A050446 and A050447 which are the main entries. Differs in indexing and adds a first row to the array resp. a diagonal to the triangle.

Examples

			Generating functions of the rows:
   gf0 =  1;
   gf1 = -1/( x-1);
   gf2 =  1/(-x-1/(-x-1));
   gf3 = -1/( x-1/( x-1/( x-1)));
   gf4 =  1/(-x-1/(-x-1/(-x-1/(-x-1))));
   gf5 = -1/( x-1/( x-1/( x-1/( x-1/( x-1)))));
   gf6 =  1/(-x-1/(-x-1/(-x-1/(-x-1/(-x-1/(-x-1))))));
   ...
Array A(n, k) starts:
  [0] 1, 0,  0,  0,   0,    0,    0,     0,      0,      0, ...  A000007
  [1] 1, 1,  1,  1,   1,    1,    1,     1,      1,      1, ...  A000012
  [2] 1, 2,  3,  5,   8,   13,   21,    34,     55,     89, ...  A000045
  [3] 1, 3,  6, 14,  31,   70,  157,   353,    793,   1782, ...  A006356
  [4] 1, 4, 10, 30,  85,  246,  707,  2037,   5864,  16886, ...  A006357
  [5] 1, 5, 15, 55, 190,  671, 2353,  8272,  29056, 102091, ...  A006358
  [6] 1, 6, 21, 91, 371, 1547, 6405, 26585, 110254, 457379, ...  A006359
   A000027,A000330,   A085461,     A244881, ...
       A000217, A006322,    A108675, ...
.
Triangle T(n, k) = A(n - k, k) starts:
  [0] 1;
  [1] 1,  0;
  [2] 1,  1,  0;
  [3] 1,  2,  1,  0;
  [4] 1,  3,  3,  1,  0;
  [5] 1,  4,  6,  5,  1,  0;
  [6] 1,  5, 10, 14,  8,  1, 0;
		

Crossrefs

Cf. A050446, A050447, A276313 (main diagonal), A373353 (row sums of triangle).
Cf. A373423.

Programs

  • Maple
    row := proc(n, len) local x, a, j, ser; if irem(n, 2) = 1 then
    a :=  x - 1; for j from 1 to n do a :=  x - 1 / a od: a :=  a - x; else
    a := -x - 1; for j from 1 to n do a := -x - 1 / a od: a := -a - x;
    fi; ser := series(a, x, len + 2); seq(coeff(ser, x, j), j = 0..len) end:
    A := (n, k) -> row(n, 12)[k+1]:      # array form
    T := (n, k) -> row(n - k, k+1)[k+1]: # triangular form
  • SageMath
    def Arow(n, len):
        R. = PowerSeriesRing(ZZ, len)
        if n == 0: return [1] + [0]*(len - 1)
        x = -x if n % 2 else x
        a = x + 1
        for _ in range(n):
            a = x - 1 / a
        a = x - a if n % 2 else a - x
        return a.list()
    for n in range(7): print(Arow(n, 10))
Showing 1-2 of 2 results.