%I #45 Oct 31 2024 01:34:56
%S 1,1,1,1,1,1,1,1,2,1,1,1,6,2,1,1,1,20,12,2,1,1,1,70,92,26,2,1,1,1,252,
%T 780,506,48,2,1,1,1,924,7002,11482,2288,86,2,1,1,1,3432,65226,284002,
%U 135040,10010,148,2,1,1,1,12870,623576,7426610,8956752,1543862,41618,250,2,1
%N Number A(n,k) of sequences with k copies each of 1,2,...,n avoiding absolute differences between adjacent elements larger than one; square array A(n,k), n>=0, k>=0, read by antidiagonals.
%C All columns are linear recurrences with constant coefficients and for k > 0 the order of the recurrence is bounded by 3*k-1. For k up to at least 17 this upper bound is exact. - _Andrew Howroyd_, May 16 2020
%C Row 2, the sequence of central binomial numbers A000984, satisfies the supercongruences u(n*p^r) == u(n*p^(r-1)) (mod p^(3*r)) for all primes p >= 5 and all positive integers n and r (see Meštrović, equation 39). This is also known to be true for row 3 (A103882) and row 4 (A177316). We conjecture that each row sequence of the table satisfies the same congruences. - _Peter Bala_, Oct 26 2024.
%H Andrew Howroyd, <a href="/A331562/b331562.txt">Antidiagonals n = 0..50, flattened</a> (antidiagonals 0..15 from Alois P. Heinz)
%H Romeo Meštrović, <a href="https://arxiv.org/abs/1111.3057">Wolstenholme's theorem: Its Generalizations and Extensions in the last hundred and fifty years (1862-2012)</a>, arXiv:1111.3057 [math.NT], (2011).
%e A(2,2) = 6: 1122, 1212, 1221, 2112, 2121, 2211.
%e A(3,2) = 12: 112233, 112323, 112332, 121233, 123321, 211233, 233211, 321123, 323211, 332112, 332121, 332211.
%e A(2,3) = 20: 111222, 112122, 112212, 112221, 121122, 121212, 121221, 122112, 122121, 122211, 211122, 211212, 211221, 212112, 212121, 212211, 221112, 221121, 221211, 222111.
%e A(3,3) = 92: 111222333, 111223233, 111223323, 111223332, ..., 333221112, 333221121, 333221211, 333222111.
%e Square array A(n,k) begins:
%e 1, 1, 1, 1, 1, 1, 1, ...
%e 1, 1, 1, 1, 1, 1, 1, ...
%e 1, 2, 6, 20, 70, 252, 924, ...
%e 1, 2, 12, 92, 780, 7002, 65226, ...
%e 1, 2, 26, 506, 11482, 284002, 7426610, ...
%e 1, 2, 48, 2288, 135040, 8956752, 640160976, ...
%e 1, 2, 86, 10010, 1543862, 276285002, 54331653686, ...
%p b:= proc(l, q) option remember; (n-> `if`(n<2, 1, add(
%p `if`(l[j]=1, `if`(j in [1, n], b(subsop(j=[][], l),
%p `if`(j=1, 0, n)), 0), b(subsop(j=l[j]-1, l), j)), j=
%p `if`(q<0, 1..n, max(1, q-1)..min(n, q+1)))))(nops(l))
%p end:
%p A:= (n, k)-> `if`(k=0, 1, b([k$n], -1)):
%p seq(seq(A(n, d-n), n=0..d), d=0..10);
%t b[l_, q_] := b[l, q] = With[{n = Length[l]}, If[n < 2, 1, Sum[
%t If[l[[j]] == 1, If[j == 1 || j == n, b[ReplacePart[l, j -> Nothing],
%t If[j == 1, 0, n]], 0], b[ReplacePart[l, j -> l[[j]] - 1], j]], {j,
%t If[q < 0, Range[n], Range[Max[1, q - 1], Min[n, q + 1]]]}]]];
%t A[n_, k_] := If[k == 0, 1, b[Table[k, {n}], -1]];
%t Table[Table[A[n, d-n], {n, 0, d}], {d, 0, 10}] // Flatten (* _Jean-François Alcover_, Jan 03 2021, after _Alois P. Heinz_ *)
%o (PARI)
%o step(m,R)={my(M=matrix(3, m+1, q, p, q--; p--; sum(j=0, m-p-q, sum(i=max(p+j-#R+1, 2*p+q+j-m), p, R[1+q, 1+p+j-i] * binomial(p,i) * binomial(p+q+j-i-1, j) * binomial(m-1, 2*p+q+j-i-1))))); M[3,]+=2*M[2,]+M[1,]; M[2,]+=M[1,]; M}
%o AdjPathsBySig(sig)={if(#sig<1, 1, my(R=[1;1;1]); for(i=1, #sig-1, R=step(sig[i], R)); my(m=sig[#sig]); sum(i=1, min(m, #R), binomial(m-1, i-1)*R[3,i]))}
%o T(n,k) = {if(k==0, 1, AdjPathsBySig(vector(n,i,k)))} \\ _Andrew Howroyd_, May 16 2020
%Y Columns k=0-9 give: A000012, A130130 (for n>0), A177282, A177291, A177298, A177301, A177304, A177307, A177310, A177313.
%Y Rows n=0+1, 2-9 give: A000012, A000984, A103882, A177316, A177317, A177318, A177319, A177320, A177321.
%Y Main diagonal gives A331623.
%Y Cf. A269129, A275784.
%K nonn,tabl,changed
%O 0,9
%A _Alois P. Heinz_, Jan 20 2020