Let $w\in \mathbb R$ and $p>0$. I want to find the p-periodic solutions of the differential equation $$ f''(x)+w^2f(x)=0. $$ Let the $p$-periodic solution be $$ f(x)=c_0+\sum_{k \in \mathbb Z \setminus \{0\}}c_k\exp\left(\dfrac{i2k\pi x}{p} \right). $$ I differentiate twice and put everything in the equation and I find $$w^2c_0+\sum_{k \in \mathbb Z \setminus \{0\}}\Big(w^2-\dfrac{4\pi^2k^2}{p^2}\Big )c_k\exp\left(\dfrac{i2k\pi x}{p} \right)=0$$
This means $$ c_0=0 \;\text{ and }\;\Big(w^2-\dfrac{4\pi^2k^2}{p^2}\Big )c_k=0\quad\forall\,k \in \mathbb Z \setminus \{0\}$$ Hence $$ c_0=0 \;\text{ and }\; c_k=0 \;\text{ or }\; w=\dfrac{2\pi k}{p}\;\text{ or }\;w=-\dfrac{2\pi k}{p}\quad\forall\,k \in \mathbb Z \setminus \{0\} \;$$
But I cannot understand how to use the last two conditions $w=\dfrac{2\pi k}{p}\;\text{or}\;w=-\dfrac{2\pi k}{p}$ since $w$ and $p$ are fixed and given.