Which functions share a certain property of sinusoids?

Among functions $f$ satisfying $\forall x\in\mathbb R\, f(x+p) = f(x)$ with $p>0$ are sinusoids $f(x) = A\sin(\omega x +\varphi)$ with $p=2\pi/\omega.$ These also satisfy the functional equations $$ \forall n\in\{2,3,\ldots\}\, \forall x\in\mathbb R \, \sum_{k\,=\,0}^{n-1} f\left(x + \frac {kp} n \right) =0. \tag 1 $$ Which functions with period $p$ satisfy $(1)$ besides sinusoids?


Assuming that the function $f$ is sufficiently regular to be represented by a Fourier series, then sinusoids are the only solutions. For a proof, note that with $f(x)=\sum_m c_m e^{i2\pi x m/p}$ we can show that

\begin{align} & \sum_{k=0}^{n-1} f\left(x+\frac{kp}{n}\right)=\sum_m c_m \exp\left(i\frac{2\pi m}{p}x\right) \sum_{k=0}^{n-1}(e^{2\pi im/n})^k \\[8pt] = {} & \sum_{r=-\infty}^\infty n c_{nr} \exp\left( \frac{2\pi ix}{p}nr\right) = 0 ~~~\forall n\geq 2 \end{align}

which implies that coefficients with numbers that are multiples of any natural number greater than two must vanish. The only numbers that are not multiples of a number $ \geq 2$ are of course, $-1$ and $1$. Therefore the most general function satisfying $(1)$ is

$$f(x)=c_1 e^{2\pi ix/p}+c_{-1} e^{-2\pi i x/p}=(c_1+c_{-1})\cos\frac{2\pi x}{p}+ i(c_1-c_{-1})\sin\frac{2\pi x}{p}$$

which in general is a complex sinusoid. If the function is assumed to be $f:\mathbb{R}\to\mathbb{R}$, only real sinusoids survive and can be written in the form posed above with a redefinition of the parameters.