5. In the country of Lemonia, coins in circulation have denominations of $3^{n}, 3^{n-1} \cdot 5, 3^{n-2} \cdot 5^{2}$, $3^{n-3} \cdot 5^{3}, \ldots, 3 \cdot 5^{n-1}, 5^{n}$ piastres, where $n-$ is a natural number. A resident of the country went to the bank without any cash on hand. What is the largest amount that the bank will not be able to issue?
Answer: $5^{n+1}-2 \cdot 3^{n+1}$.

Solution. A natural number $s$ is called $n$-decomposable if the sum $s$ can be paid using coins of denominations $3^{n}, 3^{n-1} \cdot 5, \ldots, 5^{n}$ piastres, and $n$-indecomposable otherwise. For $n=1$, only coins of 3 and 5 piastres are available. If $s \geqslant 10$, then there exists an $r \in\{0,1,2\}$ such that $(s-5 r) \vdots 3$. Then $s$ can be expressed as $5 r+3 k$, meaning it is 1-decomposable. It is also clear that the numbers 9 and 8 are 1-decomposable, while 7 is not. Thus, the maximum 1-indecomposable number is $7=5^{2}-2 \cdot 3^{2}$.

We will prove that for any natural $n$, the number $5^{n+1}-2 \cdot 3^{n+1}$ is $n$-indecomposable. We will do this by induction. The base case has already been verified. Suppose the statement is true for $n-1$. Assume that the number $s=5^{n+1}-2 \cdot 3^{n+1}$ is $n$-decomposable. If the sum $s$ includes $m$ coins of $5^{n}$ piastres, then $m5^{n+1}-2 \cdot 3^{n+1}$, meaning the number $s$ is $n$-decomposable. Again, we will use induction on $n$. The base case has already been verified. Assume the statement is true for $n-1$. Choose $r \in\{0,1,2\}$ such that $s-r \cdot 5^{n}$ is divisible by 3. Let $N=\frac{s-r \cdot 5^{n}}{3}$. Then

$$
N>\frac{5^{n+1}-2 \cdot 3^{n+1}-r \cdot 5^{n}}{3}=\frac{(5-r) 5^{n}-2 \cdot 3^{n+1}}{3} \geqslant \frac{3 \cdot 5^{n}-2 \cdot 3 \cdot 3^{n}}{3}=5^{n}-2 \cdot 3^{n}
$$

By the inductive hypothesis, $N$ is $(n-1)$-decomposable. Therefore, there exist non-negative integers $k_{1}, \ldots, k_{n}$ such that

$$
N=k_{1} \cdot 5^{n-1}+k_{2} \cdot 5^{n-2} \cdot 3+\ldots+k_{n} \cdot 3^{n-1}, \quad \text { that is } \quad s=r \cdot 5^{n}+k_{1} \cdot 5^{n-1} \cdot 3+\ldots+k_{n} \cdot 3^{n} \text {. }
$$

Thus, the number $s$ is $n$-decomposable.