Sum over permuted and unpermuted indices

I would like to write a code to evaluate the following (up to $N=20$)

$\sum_{s_1,...,s_N=\pm 1;s_1 \cdot \cdot \cdot s_N=1}\sum_{\sigma\in S_N}\prod_{i=1}^N x_{\sigma(i)}^{s_i \lambda_i}$

There are several discussions on here which tell me how to perform such a computation provided all the i's were permuted. However I do not know how to deal with this case.

• Why? What will you learn? For N = 20, the number of different permutations is larger than 2*10^18. Multiply that by 2^19 to get all the sums over the s[i] and you got yourself a waiting game. – Marius Ladegård Meyer Feb 5 '18 at 15:10
• By itself this doesn't teach me anything. It is part of a slightly more complicated function involving another variable t. I am aware of the combinatoric nightmare here and maybe N=20 is too much to ask, but if I can even look at the expansion to first order in t for example it will be useful as the x's are expected to form characters of some representation of a Lie group, which tell me about the symmetry of the problem I am looking at. What about N=6? Is this possible? Thanks – Mohammad Akhond Feb 6 '18 at 4:31

Maybe this?

bigSum[lambdalist_List] :=
Block[{n, slist, sn, sigmalist, xlist},
n = Length[lambdalist];

slist = Tuples[{-1, 1}, n - 1];
sn = Times @@@ slist;
slist = Transpose[Append[Transpose[slist], sn]];

sigmalist = Permutations[Range[n]];

Sum[
xlist = x /@ sigma;
Sum[
(Times @@ (xlist^(s*lambdalist)))
, {s, slist}
]
, {sigma, sigmalist}
]
]


It takes 0.25 s to run bigSum[Range[6]], which is when $N=6$, $\lambda_i = i$.

• This does it! Thank you :) – Mohammad Akhond Feb 7 '18 at 7:11