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.

A275784 Number A(n,k) of up-down sequences with k copies each of 1,2,...,n; square array A(n,k), n>=0, k>=0, read by antidiagonals.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 2, 1, 1, 0, 1, 4, 5, 1, 1, 0, 1, 12, 53, 16, 1, 1, 0, 1, 36, 761, 936, 61, 1, 1, 0, 1, 120, 12661, 87336, 25325, 272, 1, 1, 0, 1, 400, 229705, 9929000, 18528505, 933980, 1385, 1, 1, 0, 1, 1400, 4410665, 1267945800, 17504311533, 6376563600, 45504649, 7936, 1
Offset: 0

Views

Author

Alois P. Heinz, Aug 12 2016

Keywords

Examples

			A(4,1) = 5: 1324, 1423, 2314, 2413, 3412.
A(3,2) = 4: 121323, 132312, 231213, 231312.
A(3,3) = 12: 121313232, 121323132, 121323231, 131213232, 132312132, 132323121, 231213132, 231213231, 231312132, 231323121, 232312131, 232313121.
A(2,4) = 1: 12121212.
Square array A(n,k) begins:
  1,   1,      1,          1,              1,              1, ...
  1,   1,      0,          0,              0,              0, ...
  1,   1,      1,          1,              1,              1, ...
  1,   2,      4,         12,             36,            120, ...
  1,   5,     53,        761,          12661,         229705, ...
  1,  16,    936,      87336,        9929000,     1267945800, ...
  1,  61,  25325,   18528505,    17504311533, 19126165462061, ...
  1, 272, 933980, 6376563600, 59163289699260, ...
		

Crossrefs

Columns k=0-3 give: A000012, A000111, A275801, A276636.
Rows n=2-5 give: A000012, A241530, A036916, A276637.

Programs

  • Maple
    b:= proc(n, l) option remember; `if`(l=[], 1, `if`(irem(add(i,
          i=l), 2)=0, add(b(i, subsop(i=`if`(l[i]=1, [][], l[i]-1),
          l)), i=n+1..nops(l)), add(b(i-`if`(l[i]=1, 1, 0), subsop(
          i=`if`(l[i]=1, [][], l[i]-1), l)), i=1..n-1)))
        end:
    A:= (n, k)->`if`(k=0, 1, b(`if`(irem(k*n, 2)=0, 0, n+1), [k$n])):
    seq(seq(A(n, d-n), n=0..d), d=0..10);
  • Mathematica
    b[n_, l_List] := b[n, l] = If[l == {}, 1, If[EvenQ[Total[l]], Sum[b[i, ReplacePart[l, i -> If[l[[i]] == 1, Nothing, l[[i]]-1]]], {i, n+1, Length[l]}], Sum[b[i - If[l[[i]] == 1, 1, 0], ReplacePart[l, i -> If[l[[i]] == 1, Nothing, l[[i]]-1]]], {i, 1, n-1}]]]; A[n_, k_] := If[k == 0, 1, b[If[EvenQ[k*n], 0, n+1], Array[k&, n]]]; Table[A[n, d-n], {d, 0, 10}, {n, 0, d}] // Flatten (* Jean-François Alcover, Jan 23 2017, adapted from Maple *)