OFFSET
1,6
LINKS
Alois P. Heinz, Antidiagonals n = 1..141, flattened
FORMULA
A(n,k) = n-1 for n <= k+1.
EXAMPLE
Square array A(n,k) begins:
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ...
3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, ...
4, 5, 8, 4, 4, 4, 4, 4, 4, 4, 4, ...
5, 8, 9, 16, 5, 5, 5, 5, 5, 5, 5, ...
6, 9, 10, 17, 32, 6, 6, 6, 6, 6, 6, ...
7, 10, 16, 18, 33, 64, 7, 7, 7, 7, 7, ...
8, 13, 17, 19, 34, 65, 128, 8, 8, 8, 8, ...
9, 16, 24, 32, 35, 66, 129, 256, 9, 9, 9, ...
10, 17, 27, 33, 36, 67, 130, 257, 512, 10, 10, ...
MAPLE
A:= proc() local l, w, A; l, w, A:= proc() [] end, proc() [] end,
proc(n, k) option remember; local b; b:=
proc(x, y) option remember; `if`(x<0 or y<1, {},
{0, b(x, y-1)[], map(t-> t+l(k)[y], b(x-1, y))[]})
end;
while nops(w(k)) < n do forget(b);
l(k):= [l(k)[], (nops(l(k))+1)^k];
w(k):= sort([select(h-> h<l(k)[-1], b(k, nops(l(k))))[]])
od; w(k)[n]
end; A
end():
seq(seq(A(n, 1+d-n), n=1..d), d=1..14);
MATHEMATICA
b[n_, k_, i_, t_] := b[n, k, i, t] = n == 0 || i > 0 && t > 0 && (b[n, k, i - 1, t] || i^k <= n && b[n - i^k, k, i, t - 1]);
A[n_, k_] := A[n, k] = Module[{m}, For[m = 1 + If[n == 1, -1, A[n - 1, k]], !b[m, k, m^(1/k) // Floor, k], m++]; m];
Table[A[n, 1+d-n], {d, 1, 14}, {n, 1, d}] // Flatten (* Jean-François Alcover, Dec 03 2020, using Alois P. Heinz's code for columns *)
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Alois P. Heinz, Aug 04 2020
STATUS
approved