TITLE: Construct a continuous function $f$ over $[0,1]$ satisfying $f(0) = f(1)$ but $f(x) \neq f(x+a)$
QUESTION [8 upvotes]: Suppose $0 < a < 1$ is not of the form $\dfrac{1}{n}$ for positive integer $n$. Construct a continuous function $f$ over $[0,1]$ satisfying $f(0) = f(1)$ but $f(x) \neq f(x+a)$ for all $x \in [0,1-a]$.

This is a follow up question to this. I am wondering how it is possible to construct such a function. I would start by saying $g(x) = f(x)-f(x+a) \neq 0$ for all $x$ in the domain and then doing casework on the values of $g(x)$. But this unlike the last question doesn't have a nice casework for the values of $g(x)$ so I am stuck.

REPLY [4 votes]: Let $ n $ be the largest integer such that $ na < 1 $.
Let $ g $ be any continuous function on $ [0, a] $ such that
$$ g(0) =  0 $$
$$ g(1-na) = -n $$
$$ g(a) = 1 $$
Then choose $ f(ka+x) = g(x) + k $ for $ k \in \mathbb{N}, x \in [0,a) $
Edit: I drew a picture of $ f $:

Basically, $ f $ is found by first setting $ f(x+a) = f(x) + 1$, with $ f(0) = f(1) = 0 $.  This gives you all the points in the above drawing.  Then choose a continuous $ g $ on the first 3 points, copy it and translate it by $ (a,1) $  a bunch of times to obtain $ f $.