Problem: Find all functions $f \colon \NN \to \ZZ$ such that
\[ \left\lfloor \frac{f(mn)}{n} \right\rfloor = f(m) \]
for all positive integers $m$, $n$.

Solution: There are two families of functions that work:
for each $\alpha \in \RR$ the function $f(n) = \lfloor \alpha n \rfloor$,
and for each $\alpha \in \RR$ the function
$f(n) = \lceil \alpha n \rceil - 1$.
(For irrational $\alpha$ these two functions coincide.)
It is straightforward to check that these functions indeed work;
essentially, this follows from the identity
\[ \left\lfloor \frac{\lfloor xn \rfloor}{n} \right\rfloor
  = \lfloor x \rfloor \]
which holds for all positive integers $n$ and real numbers $x$.

We now show that every function that works must be of one of the above forms.
Let $f$ be a function that works,
and define the sequence $a_1$, $a_2$, \dots\ by $a_n = f(n!)/n!$.
Applying the give condition with $(n!, n+1)$ yields
$a_{n+1} \in [a_n, a_n + \frac{1}{n!})$. %chktex 9
It follows that the sequence $a_1$, $a_2$, \dots\ is
non-decreasing and bounded from above by $a_1 + e$,
so this sequence must converge to some limit $\alpha$.

If there exists a $k$ such that $a_k = \alpha$,
then we have $a_\ell = \alpha$ for all $\ell > k$.
For each positive integer $m$,
there exists $\ell > k$ such that $m \mid \ell!$.
Plugging in $mn=\ell!$, it then follows that
\[ f(m) = \left\lfloor \frac{f(\ell!)}{\ell! / m} \right \rfloor
  = \left \lfloor \alpha m \right \rfloor \]
for all $m$, so $f$ is of the desired form.

If there does not exist a $k$ such that $a_k = \alpha$,
we must have $a_k < \alpha$ for all $k$.
For each positive integer $m$, we can now pick an $\ell$
such that $m \mid \ell!$ and $a_{\ell} = \alpha - x$
with $x$ arbitrarily small.
It then follows from plugging in $mn=\ell!$ that
\[ f(m) = \left\lfloor \frac{f(\ell!)}{\ell! / m} \right \rfloor
  = \left\lfloor \frac{\ell!(\alpha - x)}{\ell!/m} \right\rfloor
  = \left\lfloor \alpha m - mx \right \rfloor. \]
If $\alpha m$ is an integer we can choose $\ell$ such that $mx < 1$,
and it follows that $f(m) = \lceil \alpha m \rceil - 1$.
If $\alpha m$ is not an integer we can choose $\ell$
such that $mx < \{\alpha m \}$,
and it also follows that $f(m) = \lceil \alpha m \rceil - 1$.
We conclude that in this case $f$ is again of the desired form.