5. In the country of Lemonia, coins in circulation have denominations of $5^{n}, 5^{n-1} \cdot 7, 5^{n-2} \cdot 7^{2}$, $5^{n-3} \cdot 7^{3}, \ldots, 5 \cdot 7^{n-1}, 7^{n}$ piasters, 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: $2 \cdot 7^{n+1}-3 \cdot 5^{n+1}$.

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

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

$$
N>\frac{2 \cdot 7^{n+1}-3 \cdot 5^{n+1}-r \cdot 7^{n}}{5}=\frac{(14-r) 7^{n}-3 \cdot 5^{n+1}}{5} \geqslant \frac{10 \cdot 7^{n}-15 \cdot 5^{n}}{5}=2 \cdot 7^{n}-3 \cdot 5^{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 7^{n-1}+k_{2} \cdot 7^{n-2} \cdot 5+\ldots+k_{n} \cdot 5^{n-1}, \quad \text { that is } \quad s=r \cdot 7^{n}+k_{1} \cdot 7^{n-1} \cdot 5+\ldots+k_{n} \cdot 5^{n}
$$

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

## Variant 8