login
A(n,k) is the n-th number that is a sum of at most k positive k-th powers; square array A(n,k), n>=1, k>=1, read by antidiagonals.
12

%I #16 Dec 03 2020 07:37:12

%S 0,0,1,0,1,2,0,1,2,3,0,1,2,4,4,0,1,2,3,5,5,0,1,2,3,8,8,6,0,1,2,3,4,9,

%T 9,7,0,1,2,3,4,16,10,10,8,0,1,2,3,4,5,17,16,13,9,0,1,2,3,4,5,32,18,17,

%U 16,10,0,1,2,3,4,5,6,33,19,24,17,11,0,1,2,3,4,5,6,64,34,32,27,18,12

%N A(n,k) is the n-th number that is a sum of at most k positive k-th powers; square array A(n,k), n>=1, k>=1, read by antidiagonals.

%H Alois P. Heinz, <a href="/A336820/b336820.txt">Antidiagonals n = 1..141, flattened</a>

%F A(n,k) = n-1 for n <= k+1.

%e Square array A(n,k) begins:

%e 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...

%e 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...

%e 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ...

%e 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, ...

%e 4, 5, 8, 4, 4, 4, 4, 4, 4, 4, 4, ...

%e 5, 8, 9, 16, 5, 5, 5, 5, 5, 5, 5, ...

%e 6, 9, 10, 17, 32, 6, 6, 6, 6, 6, 6, ...

%e 7, 10, 16, 18, 33, 64, 7, 7, 7, 7, 7, ...

%e 8, 13, 17, 19, 34, 65, 128, 8, 8, 8, 8, ...

%e 9, 16, 24, 32, 35, 66, 129, 256, 9, 9, 9, ...

%e 10, 17, 27, 33, 36, 67, 130, 257, 512, 10, 10, ...

%p A:= proc() local l, w, A; l, w, A:= proc() [] end, proc() [] end,

%p proc(n, k) option remember; local b; b:=

%p proc(x, y) option remember; `if`(x<0 or y<1, {},

%p {0, b(x, y-1)[], map(t-> t+l(k)[y], b(x-1, y))[]})

%p end;

%p while nops(w(k)) < n do forget(b);

%p l(k):= [l(k)[], (nops(l(k))+1)^k];

%p w(k):= sort([select(h-> h<l(k)[-1], b(k, nops(l(k))))[]])

%p od; w(k)[n]

%p end; A

%p end():

%p seq(seq(A(n, 1+d-n), n=1..d), d=1..14);

%t 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]);

%t 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];

%t 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 *)

%Y Columns k=1-11 give: A001477(n-1), A001481, A004825, A004833, A004845, A004857, A004869, A004881, A004893, A004905, A004917.

%Y A(n+j,n) for j=0-3 give: A001477(n-1), A000027, A000079, A000051.

%Y Cf. A336725.

%K nonn,tabl

%O 1,6

%A _Alois P. Heinz_, Aug 04 2020