# A restricted summation over a function of integer n-tuple

I want to sum over a function of n-tuple like so:

$\sum\limits_{a\leq k_1+k_2+...+k_n\leq b}f(\{k_i\}_{i=1}^{n})$

where each $k_i$ is non-negative, i.e. $k_i\geq0 \;\forall\;i$

An Example:

Say, we want to evaluate $\sum\limits_{2\leq k_1+k_2+k_3\leq5}k_1^{k_1!}k_2^{k_2!}k_3^{k_3!}$

My attempt:

f[k_List]:=Product[Power[k[[i]],Factorial[k[[i]]]],{i,1,Length@k}];
tuplelist[x_,n_]:=Sequence @@ Permutations[Join[#, ConstantArray[0, n - Length@#]]] & /@ IntegerPartitions[x, n];
Total@Table[Total@(f[#]&/@tuplelist[i,3]),{i,2,5}]
(*2248*)


Please suggest if there are ways to modify the existing Sum[] function or other efficient ways to do this. Looking forward to a variety of techniques!

Anjan Kumar's answer is good, but if you want to be able to give the function an expression (like with an ordinary Sum), here's one possibility (edited to make use of J. M.'s suggestion of FrobeniusSolve):

ClearAll[SumOverIntegerPartitions];
Attributes[SumOverIntegerPartitions] = {HoldFirst};
SumOverIntegerPartitions[
f_, {ks_List, min_Integer?Positive, max_Integer?Positive}] :=
With[{perms =
Catenate[
FrobeniusSolve[ConstantArray[1, Length@ks], #] & /@
Range[min, max]]},
Total[f /. (Thread[ks -> #] & /@ perms)]];


Using the same test case:

SumOverIntegerPartitions[k1^k1!*k2^k2!*k3^k3!, {{k1, k2, k3}, 2, 5}]
(* 2248 *)


You can also use FrobeniusSolve[] for this sum, since it automatically generates 0 in its tuples, unlike IntegerPartitions[]:

Sum[Product[k^k!, {k, m}],
{m, Flatten[Table[FrobeniusSolve[ConstantArray[1, 3], k], {k, 2, 5}], 1]}]
2248


You can modify your code to something like this:

f[k_] := Times @@ (#^#! & /@ k);
tuplelist[x_, n_] := Permutations /@ IntegerPartitions[x, {n}, Range[0, x]];
Outer[f, tuplelist[#, 3] & /@ Range[2, 5], 3] // Total[#, 3] &


2248