Given a sum in the form
Sum[n^k, {k, kl}]
for some natural n
and natural list kl
, is it possible to extract the values of kl
? In other words, I want to know if a sum of the form $ \sum_{i=1}^n n^{k_i} $ uniquely determines the tuple $(k_1,...,k_n)$ (up to permutations). This seems true due to the uniqueness of base-$n$ representation, but I am not sure how to implement a function to extract the tuple $(k_1,...,k_n)$. Any ideas?
My attempt: Following the discussion here, I tried to use BaseForm
. If we assume $\{k_i\}$ are different, then, as an example,
n = 3;
kl = {1, 2, 3};
BaseForm[Sum[n^k, {k, kl}], n]
yields $1110_3$ which tells me that kl = {1, 2, 3}
(in no particular order). How can I produce this list from BaseForm
? Alternatively, is there a way to transform the representation $1110_3$ into the list {1, 1, 1, 0}
?
Also, in the case where $\{k_i\}$ are all the same, we may simply take
ConstantArray[Log[n, Sum[n^k, {k, kl}]] - 1, n]
Could a straightforward computation for both cases (equal $\{k_i\}$ and not) be done? Perhaps using base $n+1$ instead?
Edit: I forgot to mention. The length of kl
must be exactly n
. Apologies to whoever started working on this without this assumption.
S
as any sum which I know can be written in that format (wherekl
is unknown), and applyBaseForm[S, n]
to extract the uniquely defined powers. In other words, I am just confirming that I do get that list, as I would expect. I am wondering if I can do this more straightforwardly by looking at the $n+1$ case, for example. The way it is written seems a bit redundant, I agree, but if you look at the linked question on MathSE, it perhaps becomes clearer. $\endgroup$kl
must be exactlyn
! Apologies, I will edit the question to add this. With this, the casekl = {1, 2, 2, 2, 2}
is not valid. $\endgroup$