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.

A318191 Number A(n,k) of lattice paths from {n}^k to {0}^k using steps that decrement one component by 1 such that for each point p we have abs(p_{i}-p_{(i mod k)+1}) <= 1 and the first component used is p_1; square array A(n,k), n>=0, k>=0, read by antidiagonals.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 6, 12, 4, 1, 1, 1, 24, 180, 72, 8, 1, 1, 1, 120, 4680, 5400, 432, 16, 1, 1, 1, 720, 187200, 914400, 162000, 2592, 32, 1, 1, 1, 5040, 10634400, 296438400, 178660800, 4860000, 15552, 64, 1, 1, 1, 40320, 813664800, 162273628800, 469551168000, 34907788800, 145800000, 93312, 128, 1, 1
Offset: 0

Views

Author

Alois P. Heinz, Jan 07 2019

Keywords

Examples

			A(2,2) = 2^2 = 4:
                    (0,1)
                   /     \
  (2,2)-(1,2)-(1,1)       (0,0)
                   \     /
                    (1,0)
Square array A(n,k) begins:
  1, 1,  1,     1,         1,             1,                   1, ...
  1, 1,  1,     2,         6,            24,                 120, ...
  1, 1,  2,    12,       180,          4680,              187200, ...
  1, 1,  4,    72,      5400,        914400,           296438400, ...
  1, 1,  8,   432,    162000,     178660800,        469551168000, ...
  1, 1, 16,  2592,   4860000,   34907788800,     743761386086400, ...
  1, 1, 32, 15552, 145800000, 6820487308800, 1178106009360998400, ...
		

Crossrefs

Columns k=0+1, 2 give: A000012, A011782.
Rows n=0-2 give: A000012, A000142(n-1) for n>0, A322782/n for n>0.
Main diagonal gives A320443.
Cf. A227655.

Programs

  • Maple
    b:= proc(l) option remember; (n-> `if`(n<2 or max(l[])=0, 1,
          add(`if`(l[i]=0 or 1 `if`(k<2 or n=0, 1, b([n-1, n$k-1])):
    seq(seq(A(n, d-n), n=0..d), d=0..10);
  • Mathematica
    b[l_] := b[l] = With[{n = Length[l]}, If[n < 2 || Max[l ] == 0, 1, Sum[If[ l[[i]] == 0 ||1 < Abs[l[[If[i == 1, 0, i] - 1]] - l[[i]] + 1] || 1 < Abs[l[[If[i == n, 0, i] + 1]] - l[[i]] + 1], 0, b[ReplacePart[l, i -> l[[i]] - 1]]], {i, n}]]];
    A[n_, k_] :=  If[k < 2 || n == 0, 1, b[Join[{n - 1}, Table[n, {k - 1}]]]];
    Table[A[n, d - n], {d, 0, 10}, {n, 0, d}] // Flatten (* Jean-François Alcover, May 13 2020, after Maple *)