OFFSET
1,3
COMMENTS
Table starts
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
6, 10, 14, 18, 22, 26, 30, 34, 38, ...
27, 69, 123, 195, 273, 375, 477, 603, ...
108, 404, 892, 1716, 2732, 4324, 6060, ...
405, 2155, 5845, 13525, 24575, 44545, ...
1458, 10830, 36042, 99774, 208146, ...
5103, 52241, 213647, 705215, ...
17496, 244648, ...
59049, ...
...
LINKS
Robert Israel, Table of n, a(n) for n = 1..10011
EXAMPLE
Some solutions for n=3, k=4:
1 0 0 0 4 4 0 0 0 0 4 2 1 2 1 0 0 0 0 1 0
0 0 0 0 1 1 3 1 0 0 0 0 0 0 0 0 0 0 0 1 0
1 0 0 0 0 0 0 0 0 0 2 1 0 0 0 1 4 1 0 0 0
MAPLE
f:= proc(n, k)
local tot, a1, a0, a2, m, u;
tot:= 0;
for a1 from 1 to n do
for a0 from 0 to n-a1 do
a2:= n-a1-a0;
if a0 = 0 then tot:= tot + n!/(a1!*a2!)*a1*(k-1)^a2
elif a2 = 0 then tot:= tot + n!/(a0!*a1!)*a1*(k+1)^a0
else
u:= n!/(a0!*a1!*a2!)*a1;
for m from 2 to k do
tot:= tot + u*((m-1)^a2 - (m-2)^a2)*(floor(k/m)+1)^a0
od
fi
od od;
tot
end proc:
seq(seq(f(i, j-i), i=1..j-1), j=2..20); # Robert Israel, Dec 15 2019
MATHEMATICA
Unprotect[Power]; 0^0 = 1; Protect[Power];
f[n_, k_] := Module[{tot, a1, a0, a2, m, u}, tot = 0; For[a1 = 1, a1 <= n, a1++, For[a0 = 0, a0 <= n - a1, a0++, a2 = n - a1 - a0; Which[a0 == 0, tot = tot + n!/(a1!*a2!)*a1*(k - 1)^a2, a2 == 0, tot = tot + n!/(a0!*a1!)*a1*(k + 1)^a0, True, u = n!/(a0!*a1!*a2!)*a1; For[m = 2, m <= k, m++, tot = tot + u*((m - 1)^a2 - (m - 2)^a2)*(Floor[k/m] + 1)^a0]]]]; tot];
Table[Table[f[i, j - i], {i, 1, j - 1}], {j, 2, 20}] // Flatten (* Jean-François Alcover, Feb 04 2023, after Robert Israel *)
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
R. H. Hardin, Apr 09 2013
STATUS
approved