Notation for the sum of product indexing over all possible string of ternary digits of length $k$.

32 Views Asked by At

Let $f_0, f_1$ and $f_2$ be three functions. What is a shorthand notation to write $$ \underbrace{f_0 f_0 \cdots f_0}_{\text{k times}} + \underbrace{f_0 f_0 \cdots f_0f_1}_{\text{k times}} + \cdots + \underbrace{f_2 f_2 \cdots f_2}_{\text{k times}} $$ In other words, the sum of the product indexing over all possible string of ternary digits of length $k$.

1

There are 1 best solutions below

0
On

I will use a general base $b$. Your case is $b=3$.

Let $R_b(n, m)$ be the $m-th$ digit of $n$ written in base $b$, with $m=0$ being the units digit. Computationally, $R_b(n, m) =\mod(\lfloor \frac{n}{b^m} \rfloor, b) $, where $\mod(u, v)$ is the remainder when $u$ is divided by $v$.

Then, if you have $b$ functions $f(i)$ for $i=0$ to $b-1$, the sum could be $\sum_{m=0}^{b^k-1} \prod_{i=0}^{k-1} f(R_b(m, i)) $.

Essentially, for all the $k$-digit numbers in base $b$, extract the digits and use them to choose the proper $f(i)$.

Nothing was said about any other parameters for the $f(i)$.