Consider a natural number $ n> $ 1. We express it as $ lfloor frac n 2 rfloor + lceil frac n 2 rceil $. We repeat the process for each of the two terms until all the terms are 1 or 2. For example $ 9 = 4 + 5 = 2 + 2 + 2 + 3 = 1 + 1 + 1 + 1 + 1 + 1 + 1 + 2 $.

There will be $ 2 ^ { lfloor log_2 n rfloor} $ terms because the decomposition forms a complete binary tree of height $ lfloor log_2 n rfloor $.

I'm looking for an iterative form of this recursive process. The enumeration $ a_0 = 0, a_ {i + 1} = left lfloor frac {(i + 1) cdot n} {2 ^ { lfloor log_2 n rfloor}} right rfloor – a_i $ approximates because it fulfills the following conditions: (a) each term is worth 1 or 2; b) the sum of the first $ 2 ^ { lfloor log_2 n rfloor} $ terms is $ n $. But the elements are not identical to the form of recursive decomposition.

Any help would be welcome. Thank you!