Repeated substitution gone wrong It was an exam question.
$$ f(n)=
\begin{cases}
0 & \mbox{if } n \leq 1 \\
3 f(\lfloor n/5 \rfloor) + 1 & \mbox{if } n > 1 \\
\end{cases}$$
So by calculating some I have $f(5) = 1$, $f(10) = 4$, $f(50) = 13$.
I had to solve this recurrence. So to get rid of the floor operator I said lets $n$ be $5^k$ so a multiple of $5$. So started to solve this.
\begin{equation}
\begin{split}
f(5^k) & = 3\cdot f(5^{k-1}) + 1\\
 & = 3\cdot[ 3f(5^{k-2}) + 1 ]+ 1\\
 & = 3^2f(5^{k-2}) + 3 + 1\\
 & = 3^2\cdot[ 3f(5^{k-3}) + 1 ]+ 3 + 1\\
 & = 3^3f(5^{k-3}) + 9 + 3 + 1 \\
 & = ...\\
 & = 3^jf(5^{k-j}) + \sum_{j=0}^k 3^j\\
 & = 3^jf(5^{k-j}) + \frac{3^{k+1} - 1}{2}\\
\text{let $j = k$}\\
 & = 3^kf(5^0) + \frac{3^{k+1} - 1}{2}\\
 & = 3^kf(1) + \frac{3^{k+1} - 1}{2}\\
 & = 3^k\cdot 0 + \frac{3^{k+1} - 1}{2}\\
 & = \frac{3^{k+1} - 1}{2}\\
\end{split}
\end{equation}
And now I'm stuck here trying to express my $3^{k+1}$ as a function of $n$.
I'm pretty I probably made some error up there, if I did I don't see them.

I didn't check your whole argument, but assuming it's correct, you can use the fact that if $n$ is $5^k$, then $k$ is $\log_5 n$ to express the result in terms of $n$.
(Side Question: are the $x$'s in the function definition supposed to be $n$'s?)
