Greatings,
Some time ago a friend of mine showed me this astonishing algorithm and recently i tried to find some information about it on the internet but couldn't find anything... Please help.
Pseudocode:
Consider that 1 is the starting index of a list
1. input natural number n.
2. let s = list of all natural numbers {1, 2, 3, 4, 5, 6 ...}
3. while (n>1) do
3.1. drop each n-th elementh from s
3.2. for int i = 2 to ∞ do s[i] += s[i-1]
3.3. n = n-1
4. Now s = {1n, 2n, 3n, 4n ...}
Example:
n = 3
s = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...}
perform 3.1: s = {1, 2, 4, 5, 7, 8, 10, 11, 13, 14, 16...}
perform 3.2: s = {1, 3, 7, 12, 19, 27, 37, 48, 61, 75, 91 ...}
perform 3.3: n = 2 > 1
perform 3.1: s = {1, 7, 19, 37, 61, 91 ...}
perform 3.2: s = {1, 8, 27, 64, 125, 216 ...}
perform 3.3: n = 1 => end of while loop
The final state of s is {13, 23, 33, 43, 53 ...}
Note: [2014-11-24] Some more simplifications done, some new aspects added and general proof now finalised. :-)
Let's start with a slight reformulation of the algorithm which may also be convenient.
Observe that in the question above $s[i] += s[i-1]$ should be more precisely denoted as \begin{align*} s^{(n-1)}[i]=s^{(n)}[i]+s^{(n-1)}[i-1],\tag{1} \end{align*} so that $s^{(n-1)}[i]=\sum_{j=1}^{i}s^{(n)}[j]$ becomes in round $n-1$ the partial sum of the first $i$ elements of $s^{(n)}$ from the predecessor round $n$.
In order to see what's going on we take a look at two examples, namely at the powers of $n=5$ and $n=6$ which are small enough to be manageable, but also large enough to detect some essential aspects of the algorithm.
At first let's take a look at the example $n=5$ row-oriented:
But even more interesting is to look at the example according to the triangular shapes:
Note: In the following I write vectors row-oriented without using the transpose symbol in order to enhance readability.
The general description of the first row of the $k$-th matrix $T_{5,k}$ is:
\begin{align*} \left(t_{1,j}^{(5,1)}\right)_{1\leq j \leq 5}&=(1,2,3,4,5)\\ \left(t_{1,j}^{(5,2)}\right)_{1\leq j \leq 5}&=(6,7,8,9,10)\\ &\ldots\\ \left(t_{1,j}^{(5,k)}\right)_{1\leq j \leq 5}&=\Big(5(k-1)+j\Big)_{1\leq j \leq 5}\qquad k \geq 1 \end{align*}
The elements of the minor diagonal
$$\text{diag}_{min} \left(T_{5,k}\right)=\left(t_{j,6-j}\right)_{1\leq j \leq 5}$$
of the matrix $T_{5,k}$ show a nice relationship
\begin{align*} \text{diag}_{min}\left(T_{5,1}\right)_{1\leq j \leq 5}&=(5,10,10,5,\mathbf{1})\\ &=\left(\binom{5}{1},\binom{5}{2},\binom{5}{3},\binom{5}{4},\mathbf{1^5}\right)\\ \text{diag}_{min}\left(T_{5,2}\right)_{1\leq j \leq 5}&=(10,40,80,80,\mathbf{32})\\ &=\left(\binom{5}{1}2^1,\binom{5}{2}2^2,\binom{5}{3}2^3,\binom{5}{4}2^4,\mathbf{2^5}\right)\\ \text{diag}_{min}\left(T_{5,3}\right)_{1\leq j \leq 5}&=(15,90,270,405,\mathbf{243})\\ &=\left(\binom{5}{1}3^1,\binom{5}{2}3^2,\binom{5}{3}3^3,\binom{5}{4}3^4,\mathbf{3^5}\right)\\ &\ldots\\ \text{diag}_{min}\left(T_{5,k}\right)_{1\leq j \leq 5} &=\left(\binom{5}{1}k^1,\binom{5}{2}k^2,\binom{5}{3}k^3,\binom{5}{4}k^4,\mathbf{k^5}\right)\\ \end{align*}
Observe that the entries of the leftmost column of $T_{5,k}$ are the sum of the elements of the minor diagonal of the predecessor matrix $T_{5,k-1}$ incremented by one. Therefore we get
\begin{align*} \left(t_{j,1}^{(5,k)}\right)_{1\leq j \leq 5} &=\left(1+\sum_{l=1}^{j}\binom{5}{l}(k-1)^l\right)_{1\leq j \leq 5}\qquad\qquad k \geq 2\\ &=\left(\sum_{l=0}^{j}\binom{5}{l}(k-1)^l\right)_{1\leq j \leq 5}\\ \end{align*}
has following properties
The bottom element of the leftmost column is $k^n$:
$$t_{n,1}^{(n,k)} = \mathbf{k^n}, \qquad\qquad k \geq 1, n \geq 2$$
The elements of the minor diagonal
$$\text{diag}_{min} \left(T_{n,k}\right)=\left(t_{j,n+1-j}\right)_{1\leq j \leq n}$$
fulfil
\begin{align*} \text{diag}_{min}\left(T_{n,k}\right) &=\left(\binom{n}{1}k^1,\binom{n}{2}k^2,\ldots,\binom{n}{n-1}k^{n-1},\mathbf{k^n}\right)\\ \end{align*}
Let $n\geq 2$ be fixed, arbitrary.
The algorithm starts with $S=\{1,2,3,\ldots\}$. Since this is represented by the top row of $T_{n,k}$ which contains the $k-th$ block of $n$ consecutive numbers, the top row of $T_{n,1}$ contains the first $n$ natural numbers and the statement is true.
Since the leftmost element $1$ is never changed by the algorithm, the leftmost column of $T_{n,1}$ is always $1$.
The addition scheme of the upper triangle of the matrix corresponds to the relationship (1) of the algorithm: \begin{align*} s^{(n-1)}[i]=s^{(n)}[i]+s^{(n-1)}[i-1] \end{align*} The zero in position $(2,n)$ corresponds to the fact, that in the first round of the algorithm each $n-th$ element has been dropped.
The zeros in position $(3,n-1)$ an $(3,n)$ correspond to the fact that in the second round of the algorithm each $(n-1)$-th element has been also dropped.
Continuing this way results in zeros filling the lower triangular part of the matrix $T_{n,1}$ and so the statement is true.
This is simply a consequence of the fact, that the leftmost column of the matrix contains only $1$s.
The minor diagonal of $T_{n,1}$ is the $n$-th row of the Pascal Triangle and has therefore the entries $\binom{n}{j}$, with $1\leq j \leq n$ and the statement is true.
Conclusion: The base step is fulfilled.
Let's assume the proposition is true for $k \geq 1$
Since the $T_{n,k+1}$ is the successor matrix on the right hand side of $T_{n,k}$ the first row consists of the elements \begin{align*} \left(t_{1,j}^{(n,k+1)}\right)_{1\leq j \leq n}&=\Big(nk+j\Big)_{1\leq j \leq n}\qquad n\geq 2 \end{align*} and the statement is true for $k+1$
Now, the elements $(t_{1,j}^{(n,k+1)})_{1\leq j \leq n}$ of the leftmost column of $T_{n,k+1}$ are according to the relationship (1) of the algorithm: \begin{align*} s^{(n-1)}[i]=s^{(n)}[i]+s^{(n-1)}[i-1] \end{align*} the partial sums of the minor diagonal of $T_{n,k}$ incremented by one
\begin{align*} \text{diag}_{min} \left(T_{n,k}\right)=\left(t_{j,n+1-j}\right)_{1\leq j \leq n} \end{align*} and therefore
\begin{align*} \left(t_{1,j}^{(n,k+1)}\right)_{1\leq j \leq n}&=\left(1+\sum_{1\leq l \leq j}\left(t_{j,n+1-j}^{(n,k)}\right)\right)_{1\leq j \leq n}\tag{2}\\ &=\left(1+\sum_{1\leq l \leq j}\binom{n}{l}k^{l}\right)_{1\leq j \leq n}\\ &=\left(\sum_{0\leq l \leq j}\binom{n}{l}k^{l}\right)_{1\leq j \leq n}\\ \end{align*}
and the statement is true for $k+1$
Since the additions scheme is completely independent from $k$, the explanation already stated in the base case of this induction proof is also verbatim valid.
Therefore the statement is true for $k+1$.
The leftmost column is already known and so we get according to (2)
So, the statement is true for $k+1$.
\begin{align*} \text{diag}_{min} \left(T_{n,k}\right)&\qquad\longrightarrow\qquad\text{diag}_{min} \left(T_{n,k+1}\right)\\ \\ \binom{n}{j}k^j&\qquad\longrightarrow\qquad\binom{n}{j}(k+1)^j\qquad 1 \leq j \leq n \end{align*}
In order to prove it we consider the relationship of the diagonal element $t_{j,n+1-j}^{(n,k+1)}$ with the elements of the top row and the elements of the leftmost column, which are already known. The relationship is given by the addition scheme (1) according to the Pascal Triangle.
This is valid because there are $\binom{n}{k}$ choices to select $k$ steps in horizontal direction leaving the remaining $n-k$ steps for the vertical direction.
Note: You might want to look at example 1 or example 2 if you are not familiar with this technique.
In doing so, we don't have to cope with the partial sums
$$\sum_{m=1}^{j}\binom{n}{m}k^j\qquad\qquad 1 \leq j \leq n$$
of the elements of the first column of $T_{n,k+1}$ but we can instead use
$$\binom{n}{j}k^j\qquad\qquad 1 \leq j \leq n$$.
Observe, that the algorithm can be equivalently reformulated by starting with a top row containing only $1$s instead of starting with a top row of the natural numbers. We only have to perform an additional step by building first a sequence of partial sums to get the natural numbers before start dropping the $n$-th elements.
Example: $n=6:$
\begin{array}{rrrrrrrrrrrr} 1&1&1&1&1&1&1&1&1&1&1&1\\ 1&2&3&4&5&6&7&8&9&10&11&12\\ 1&3&6&10&15& &22&30&39&49&60&\\ &&\ldots&&&&&&\ldots&&& \end{array}
The benefit is, that instead of multiplying combinatorial sums with the elements $(n(k+1)+j)$ of the top row of $T_{n,k+1}$ we can simply use the factor $1$.
With this example in mind we can derive the general formula for the elements of the minor diagonal:
Note: Let $0\leq x_1\leq x_2$ and $0\leq y_1\leq y_2$. The number of pathes $N_{(x_1,y_1)}^{(x_2,y_2)}$ from $(x_1,y_1)$ to $(x_2,y_2)$ is $$N_{(x_1,y_1)}^{(x_2,y_2)}=\binom{x_2-x_1+y_2-y_1}{x_2-x_1}=\binom{x_2-x_1+y_2-y_1}{y_2-y_1}$$
We calculate each sum of (3) separately:
\begin{align*} \sum_{m=1}^{j}&\binom{n-m}{n-j}\binom{n}{m}k^n\\ &=\sum_{m=1}^{j}\frac{(n-m)!}{(n-j)!(j-m)!}\frac{n!}{m!(n-m)!}k^m\\ &=\frac{n!}{(n-j)!}\sum_{m=1}^{j}\frac{1}{(j-m)!m!}k^m\\ &=\binom{n}{j}\sum_{m=1}^{j}\binom{j}{m}k^m\\ &=\binom{n}{j}\left((k+1)^j-1\right)\\ &=\binom{n}{j}(k+1)^j-\binom{n}{j} \tag{4} \end{align*}
\begin{align*} \sum_{m=1}^{n+1-j}&\binom{n-m}{j-1}\\ &=\sum_{m=1}^{n+1-j}\left(\binom{n-m+1}{j}-\binom{n-m}{j}\right)\\ &=\sum_{m=0}^{n-j}\binom{n-m}{j}-\sum_{m=1}^{n+1-j}\binom{n-m}{j}\\ &=\binom{n}{j}-\binom{j-1}{j}\\ &=\binom{n}{j} \tag{5} \end{align*}
Observe that we have transformed the sum in (5) into a telescoping sum using the binomial identity \begin{align*} \binom{n}{k}=\binom{n-1}{k}+\binom{n-1}{k-1} \end{align*}
Conclusion: Inductive step $k \longrightarrow k+1$ is korrect.