OFFSET
0,18
COMMENTS
In a meander word letters of neighboring positions have to be neighbors in the alphabet, where in a cyclic alphabet the first and the last letters are considered neighbors too. The words are not considered cyclic here.
A word is initially rising if it is empty or if it begins with the first letter of the alphabet that can only be followed by the second letter in this word position.
A(n,k) is also the number of (n*k-1)-step walks on k-dimensional cubic lattice from (1,0,...,0) to (n,n,...,n) with positive unit steps in all dimensions such that the indices of dimensions used in consecutive steps differ by 1 or are in the set {1,k}.
LINKS
Alois P. Heinz, Antidiagonals n = 0..15, flattened
EXAMPLE
A(0,0) = A(0,k) = A(n,0) = 1: the empty word.
A(1,1) = 1 = |{a}|.
A(2,1) = 0 = |{ }|.
A(2,2) = 1 = |{abab}|.
A(2,3) = 5 = |{abacbc, abcabc, abcacb, abcbac, abcbca}|.
A(1,4) = 1 = |{abcd}|.
A(2,4) = 9 = |{ababcdcd, abadcbcd, abadcdcb, abcbadcd, abcbcdad, abcdabcd, abcdadcb, abcdcbad, abcdcdab}|.
Square array A(n,k) begins:
1, 1, 1, 1, 1, 1, 1, ...
1, 1, 1, 1, 1, 1, 1, ...
1, 0, 1, 5, 9, 11, 16, ...
1, 0, 1, 29, 100, 182, 484, ...
1, 0, 1, 182, 1225, 3542, 17956, ...
1, 0, 1, 1198, 15876, 76258, 749956, ...
1, 0, 1, 8142, 213444, 1753522, 33779344, ...
MAPLE
b:= proc() option remember; local n; n:= nargs;
`if`({args}={0}, 1,
`if`(args[2]>0, b(args[2]-1, args[i]$i=3..n, args[1]), 0)+
`if`(n>2 and args[n]>0, b(args[n]-1, args[i]$i=1..n-1), 0))
end:
A:= (n, k)-> `if`(n<2, 1, `if`(k<2, 1-k, b((n-1)$2, n$(k-2)))):
seq(seq(A(n, d-n), n=0..d), d=0..10);
MATHEMATICA
b[args_List] := b[args] = Module[{n = Length[args]}, If[Union[args] == {0}, 1, If[args[[2]] > 0, b[Join[{args[[2]] - 1}, args[[3 ;; n]], { args[[1]]}]], 0] + If[n > 2 && args[[n]] > 0, b[Join[{args[[n]] - 1}, args[[1 ;; n - 1]]]], 0]]]; A[n_, k_] := If[n < 2, 1, If[k < 2, 1 - k, b[Join[{n - 1, n - 1}, Array[n&, k - 2]]]]]; Table[Table[A[n, d - n], {n, 0, d}], {d, 0, 10}] // Flatten (* Jean-François Alcover, Jan 21 2015, after Alois P. Heinz *)
CROSSREFS
KEYWORD
AUTHOR
Alois P. Heinz, Mar 06 2012
STATUS
approved