A274859 Number A(n,k) of set partitions of [n] such that the difference between each element and its index (in the partition) is a multiple of k; square array A(n,k), n>=0, k>=0, read by antidiagonals.
1, 1, 1, 1, 1, 2, 1, 1, 2, 4, 1, 1, 2, 5, 8, 1, 1, 2, 4, 15, 16, 1, 1, 2, 4, 8, 52, 32, 1, 1, 2, 4, 8, 18, 203, 64, 1, 1, 2, 4, 8, 16, 40, 877, 128, 1, 1, 2, 4, 8, 16, 32, 101, 4140, 256, 1, 1, 2, 4, 8, 16, 32, 68, 254, 21147, 512, 1, 1, 2, 4, 8, 16, 32, 64, 144, 723, 115975, 1024
Offset: 0
Examples
Square array A(n,k) begins: : 1, 1, 1, 1, 1, 1, 1, ... : 1, 1, 1, 1, 1, 1, 1, ... : 2, 2, 2, 2, 2, 2, 2, ... : 4, 5, 4, 4, 4, 4, 4, ... : 8, 15, 8, 8, 8, 8, 8, ... : 16, 52, 18, 16, 16, 16, 16, ... : 32, 203, 40, 32, 32, 32, 32, ... : 64, 877, 101, 68, 64, 64, 64, ... : 128, 4140, 254, 144, 128, 128, 128, ... : 256, 21147, 723, 304, 264, 256, 256, ... : 512, 115975, 2064, 692, 544, 512, 512, ...
Links
- Alois P. Heinz, Antidiagonals n = 0..34, flattened
Crossrefs
Programs
-
Maple
b:= proc(l, k, i, t) option remember; `if`(l=[], 1, add(`if`(l[j]=t, b(subsop(j=[][], l), k, j, irem(1+t, k)), 0), j=[1, $i..nops(l)])) end: A:= (n, k)-> `if`(n=0, 1, `if`(k=0, 2^(n-1), b([seq( irem(i, k), i=2..n)], k, 1, irem(2, k)))): seq(seq(A(n, d-n), n=0..d), d=0..15);
-
Mathematica
b[l_, k_, i_, t_] := b[l, k, i, t] = If[l == {}, 1, Sum[If[l[[j]] == t, b[ReplacePart[l, j -> Nothing], k, j, Mod[1+t, k]], 0], {j, Prepend[ Range[i, Length[l]], 1]}]]; A[n_, k_] := If[n==0, 1, If[k==0, 2^(n-1), b[Flatten[Table[Mod[i, k], {i, 2, n}]], k, 1, Mod[2, k]]]]; Table[A[n, d - n], {d, 0, 15}, {n, 0, d}] // Flatten (* Jean-François Alcover, Feb 02 2017, translated from Maple *)