Finding a function $f$ such that $f(3n)=1$, $f(3n+1)=5/3$, $f(3n+2)=8/3$, where $n$ is an integer 
Determine a function $f(x)$ such that :

*

*$f(3n)=1$

*$f(3n+1)=5/3$

*$f(3n+2)=8/3$
where $n$ is an integer

How can you determine it? Thanks for the help!
 A: $$f(x)=\begin{cases}
1&& \text{if $x=3n$ for some integer $n$}\\
\frac53&& \text{if $x=3n+1$ for some integer $n$}\\
\frac83&& \text{if $x=3n+2$ for some integer $n$}\\
0&&\text{any other point in the domain of }f
\end{cases}$$
A closed form description of this function is 
$$f(x)=\mathbf1[3\Bbb Z]+\dfrac53\times\mathbf1[3\mathbb Z+1]+\dfrac83\times\mathbf1[3\Bbb Z+2]$$
where $\mathbf1[A]$ is the indicator function of $A$.
A: I guess, topicstarter wants some closed form description of his function like 
$$f(k)=\frac{9}{2}(1*(k+1-3[\frac{k+1}{3}])(k+2-3[\frac{k+2}{3}])+\frac{5}{3}*(k-3[\frac{k}{3}])(k+1-3[\frac{k+1}{3}])+\frac{8}{3}*(k+2-3[\frac{k+2}{3}])(k-3[\frac{k}{3}]).$$
A: There are several ways to interpret the question and find an answer.
The trigonometric sum function
$$ f(x) := \frac{16}9 - \frac1{\sqrt{3}}\sin(2\pi x/3)
 - \frac79\cos(2\pi x/3) $$ satisfies the conditions you specified.
 For example,
$$ f(3n) = \frac{16}9 - \frac1{\sqrt{3}}\sin(2\pi n) - \frac79\cos(2\pi n) 
  = \frac{16}9 - 0 - \frac79 = 1. $$
The three constants were determined by solving three linear equations.
