We have a tower made of $N$ blocks. With each new turn, tower can lose $N_1$ blocks with probability $p_1$, lose $N_2$ blocks with probability $p_2$, lose all the blocks it has with probability $p_3$, or don't lose any blocks at all. Also, each turn, $A$ blocks are added (if needed, because the tower can't have more than $N$ blocks). Tower is considered stable if it has $B$ or more blocks for 80% of time. We need to find $A$.
Solving reccurence relation $$S(1)=N$$ $$S(n)=(1-p_3)*S(n-1)+A-p_1N_1-p_2N_2$$
gives
Thus as n goes to infinity, $$S(n)→(A-p_1N_1-p_2N_2)/p_3$$ Then the tower is stable if $$A⩾p_3*B+p_1*N_1+p_2*N_2$$
Is it correct? I feel like something is wrong because I didn't use the fact that the tower can't have more than $N$ or less than 0 blocks.
[edited]: I've tried to use Markov chain, but now I have problems with interpreting the results. Here I have 5 states:
- the tower has $N$ blocks
- the tower loses $N_1$ blocks and gains $A$ blocks
- the tower loses $N_2$ blocks and gains $A$ blocks
- has lost all the blocks
gains $A$ blocks
Seems like my equilibrium state is [1 1 1 1 1], those with the eigenvalue 1.

