Actually that would work. We know that
[itex]f(x) = \sin(2 \pi x / L)[/itex]
has period L, so in our example L=6.
Then all we need to do is find the Newton polynomial solving
[itex]f(0) \mapsto 0[/itex]
[itex]f(1) \mapsto 1[/itex]
[itex]f(2) \mapsto 1[/itex]
and so on. Call this p(y).
Then [itex]p \circ f (x)[/itex] gives what we want.