Given that the digits of an $n$-digit number can only take elements from the set $\{1,2,3,4,5\}$, let the number of $n$-digit numbers containing the digit 5 and having no 3 before the 5 be $f(n)$. Find $f(n)$.
（Supplied by Jiang Ximing）
For the number of $(n+1)$-digit numbers $f(n+1)$ that satisfy the conditions, we can divide it into the following two scenarios:

Scenario 1: When the unit digit is not 5, then the first $n$ digits must contain the digit 5, making it a valid $n$-digit number, the count of which is $f(n)$. For each such $n$-digit number, we can append any one of the digits 1, 2, 3, 4 to its rightmost end to form an $(n+1)$-digit number. Therefore, the number of $(n+1)$-digit numbers with a unit digit not 5 is $4 f(n)$.

Scenario 2: When the unit digit is 5, since there cannot be a 3 before the 5, each of the first $n$ digits has 4 possible choices. Therefore, the number of $(n+1)$-digit numbers with a unit digit of 5 is $4^n$. Thus,
$$
f(n+1)=4 f(n)+4^{n} \text {, }
$$
which implies $\frac{f(n+1)}{4^{n}}-\frac{f(n)}{4^{n-1}}=1$.
Clearly, $f(1)=1$.
Then $\frac{f(n)}{4^{n-1}}=1+(n-1)=n$.
Hence, $f(n)=n \cdot 4^{n-1}$.