Let $a\in\mathbb N^\mathbb Z$ be a bounded sequence of positive integers. Define another bounded sequence of positive integers $b=b(a)\in\mathbb N^\mathbb Z$ by
$$
b\_n=\sum\_{l=0}^\infty \max\{0,a\_{n+l}-l\}. 
$$


For a constant sequence $a\equiv k\in\mathbb N$, then $b(a)\equiv \frac {k(k+1)}{2}$. Is the converse also true? That is, for every $k\in\mathbb N$, the equation $b(a)\equiv \frac {k(k+1)}{2}$ has a unique solution. More generally, is it true that for every $k\in\mathbb N$, the equation $b(a)=k$ has a unique solution up to a shift transformation?



> 
> **Acknowledgement.** This question originated from a puzzle that I heard from a friend who heard it from Ruth Lawrence
>  <https://en.wikipedia.org/wiki/Ruth_Lawrence>. Apparently, the problem
>  is known as "Bulgarian Solitaire," as pointed out by Brian Hopkins who
>  wrote an essay on it
>  <https://www.researchgate.net/publication/259735333_30_Years_of_Bulgarian_Solitaire>.
> 
> 
> The original problem is told as follows: There are 66 cards arrange in
>  a few stacks. On each turn, one card is from each stack is taken and
>  the taken cards form a new stack. Prove that the process necessarily
>  reaches the fixed point where there are stacks of one, two, three,...
>  to eleven cards.
> 
> 
> 


[I did not know how to tag this question. Since $b$ is an operator on $\ell\_{\infty}$ I put it under "banach-spaces"] 



A certain operator on integer sequences
Yes, this is true if specifically $b\_n=k(k+1)/2$; however, in general, the sequences $a\_n$ with $b\_n=c$ are exactly the ones that take only two consecutive values $M,M-1$, repeated in an $M$ periodic pattern.


When we sum the $a\_{n+j}-j$ over $j\ge 0$ to compute $b\_n$, we can impose the restriction $a\_{n+j}-j\ge 0$ or $\ge 1$. So
$$
b\_{n+1}=\sum\_{j\ge 1; a\_{n+j}-j+1\ge 1} (a\_{n+j}-j+1) = \sum\_{j\ge 1; a\_{n+j}-j\ge 0} (a\_{n+j}-j+1) ,
$$
and this shows that $b\_{n+1}-b\_n=N\_n - a\_n$, where $N\_n$ is the number of $j\ge 1$ with $a\_{n+j}-j\ge 0$.


Now look at an $n$ with $a\_n=M:=\max a\_k$; let's say $n=0$ for convenience. Since we must have $N\_0=M$, it follows that $a\_M=M$. Now we can see that $a\_n=M-1$ or $=M$ for all $n$: This is certainly true for $n=1$ since $N\_1\ge M-1$. Moreover, $a\_{M+1}\ge M-1$ by the same argument, and it then follows that $a\_{M+1}=a\_1$, or $N\_1$ wouldn't come out right. This means that for $1\le j\le M-1$, we already know that $a\_{2+j}\ge j$ (and $j=M$ may or may not satisfy this inequality), so we now see in the same way that $N\_2=a\_2=a\_{M+2}\ge M-1$ also etc.


Conversely, any such $M$ periodic sequence $a\_n$ that takes only the two values $M,M-1$ will lead to a constant $b\_n$. This is obvious in fact since only $j=M$ can possibly fail to contribute to $N\_n$, and which of these cases we are in depends on whether $a\_{n+M}=a\_n=M-1$ or $M$, as required.


Finally, if you take a pattern with the value $M-1$ taken $p$ times in the block $0\le j\le M$, then $b\_n=M(M+1)/2-p$, and since $0\le p\le M-1$, we see that any constant value for $b\_n$ can be obtained in this way. If specifically $b\_n=k(k+1)/2$, then only $M=k$, $p=0$ works here, so in this case, $a\_n$ must indeed be constant, as you suspected.


In fact, in general, both $M$ and $p$ are uniquely determined by the constant value of $c$, but of course how you distribute the $p$ values of $M-1$ within a period block is up to you.


