Consider a sequence of terms of powers of $m\in\mathbb{R}$ as $$ M_n = m^0, m^1, m^2, m^3, \ldots, m^n $$ and create a set that contains all the values of the various signed combinations of these terms. For example, for $M_2 = m^0,m^1,m^2$ we would have our set $S$ containing the values $$ |m^0 + m + m^2| $$ $$ |m^0 - m + m^2| $$ $$ |m^0 + m - m^2| $$ $$ |m^0 - m - m^2| $$
Notice that we always keep $m^0$ positive. Now, in the special case of $m=2$ it turns out that our set $S$ will always comprise of the first $2^n$ odd numbers. This means that our example with $M_2$ $$ S = \{1,3,5,7\} $$
This is very nice because we can create a nice, indexed closed form of our set using the formula $$ S = \{2k-1 | 1\leq k \leq n\} $$ which then makes summations incredibly easy.
My question is, does there exist such a closed form expression that iterates over all values of a set $S$, given any $m$ and any $n$?
Input: $m,n$.
Algorithm: Solve $a_k:=ma_{k-1}-2$, $a_1=2$; and $b_k:=mb_{k-1}-1$, $b_1=1$.
Output: The set $S_{m,n}$ is given by the fractal sequence $$b_n+a_1+a_2+a_1+a_3+a_1+\cdots+a_{n-1}+\cdots+a_1+a_2+a_1$$
Example: For $m=5$, $a_k=\frac{1}{2}(3.5^{k-1}+1)=(2,8,38,188,938,\ldots)$.
$b_k=\frac{1}{4}(3.5^{k-1}+1)=(1, 4, 19, 94, 469, 2344,\ldots)$
$S_{5,5}$ is given by $$469+2+8+2+38+2+8+2+188+2+8+2+38+2+8+2$$ $$S_{5,5}=\{469, 471, 479, 481, 519, 521, 529, 531, 719, 721, 729, 731, 769, 771, 779, 781\}$$