I've created a small challenge for myself, stated below;
Find $f_1(x),f_2(x)$, and $f_3(x)$ if $f_n(x)$ is a smooth function s.t. $f_n(m)=\lceil\frac{m}{n}\rceil\space\space \forall \space\space m\in\Bbb{Z}$
It's clear that $f_1(x)=x$, and subtracting $f_2(m)$ by $\frac{m}{2}$ will reveal that $f_2(x)=\frac{x}{2}+\frac{1-\text{cos}(\pi x)}{4}$, however I cannot find any ways to solve for $f_3(x)$. Does an elementary function exist? And what techniques can I use to determine $f_n(x)$ for any n?
Let $\phi(x) = f(x) -{x \over 3}$. Note that $\phi(0) = 0, \phi(1) = {2 \over 3}, \phi(2) = {4 \over 3}, \phi(3) = 0$. So we look for a $3$-periodic function with these values. Note that $\sin({2 \pi \over 3} 1 ) = {\sqrt{3} \over 2}$ and $\sin({2 \pi \over 3} 2 ) = -{\sqrt{3} \over 2}$.
Now define the second degree polynomial $p$ by $p(0) =0, p({\sqrt{3} \over 2}) = {2 \over 3}, p(-{\sqrt{3} \over 2}) = {4 \over 3}$ and compose to get $\phi(x) = p(\sin({2 \pi \over 3}x))$ which is smooth, and then $f(x) = \phi(x)+{x \over 3}$.
($p(x) = {4 \over 3}x^2-{2 \over 3 \sqrt{3}} x$.)