The sum of two continuous periodic functions is periodic if and only if the ratio of their periods is rational? There are several questions here on MSE about the periodicity of the sum of two continuous, periodic functions. Here's what I know so far:


*

*It's obvious that if the ratio of the periods is rational, the sum of the functions will be periodic with a period equal to the LCM of the individual periods.

*It's relatively easy to give a counterexample to show that the sum of two continuous periodic functions is not always periodic, for instance by considering $\sin(x) + \sin(\pi x)$.
My hunch is that in fact, the sum of two continuous periodic functions is periodic if and only if the ratio of their periods is rational. First of all, is this true?
Secondly, if it's true, the sufficient part  is obvious, but is there a simple proof to show the necessary part? 
By a "simple" proof I mean one that is accessible to someone with no extensive formal knowledge of analysis or algebra. This is the closest proof I could find, but I can't quite follow it.
 A: Let $f,g$ be continuous and periodic with period $p,q$ where $\alpha=\frac pq$ is irrational. Assume $f+g$ is periodic with period $r$. Let $f(x_0)=\max f$ and $g(x_1)=\max g$.
Then the set $\{\,np+mq\mid n,m\in\mathbb Z\,\}$ is dense in $\mathbb R$.
Let $\epsilon>0$. Then for some $\delta>0$, $|x-x_1|<\delta$ implies $g(x)>g(x_1)-\epsilon$.
Let $np+mq$ differ by less than $\delta$ from $x_1-x_0$.
Then $f(x_0+np)=\max f$ and $g(x_0+np)>\max g-\epsilon$.
We conclude that $\max(f+g)=\max f+\max g$.
So assume $(f+g)(x_2)=\max (f+g)=\max f+\max g$.
Then $(f+g)(x_2+nr)=\max(f+g)$ implies that also $f(x_2+nr)=\max f$ and $g(x_2+nr)=\max g$.
At least one of $\frac rp$, $\frac rq$ is irrational, say $\frac rp$ is irrational.
Then the set $\{\,x_2+nr+mp\mid n,m\in\mathbb Z\,\}$ is dense in $\mathbb R$ and we conclude that $f(x)=\max f$ on this dense set and hence throughout. Thus $f$ is constant.
In summary: The sum of two nonconstant continuous periodic functions with incommensurable periods is not periodic.
A: $f(x+p)=f(x); g(x+p')=g(x) \rightarrow (f+g)(x)=f(x+kp)+g(x+k'p'); k \in \mathbb Z $ . Now, $f+g$ must satisfy both periods $p,p'$, so:
Then, for a period, we need $$ x+kp=x+k'p'\rightarrow \frac {k}{k'}= \frac{p}{p'} $$. 
EDIT: My claim: given $f,g$ periodic, then $h:=f+g$ repeats precisely , i.e., iff $f,g$ simultaneously repeat, i.e., $h$ must satisfy the periods of both $f,g$. This happens precisely when the ratio of their periods is Rational. 
