Suppose that $f$ is a periodic function defined on the integers with period $mn$, with $m$ and $n$ coprime integers. Does there necessarily exist a function $g$ with period $m$ such that $f-g$ is periodic with period $n$? In other words and slightly more generally, can any periodic function with a composite period $P$ (other than a prime power) be written as a sum of periodic functions with periods $p_1,p_2,\ldots$ with $\text{lcm}(p_1,p_2,\ldots)=P$?
It seems to me that this should be true, since for example in the first case this is analogous to $f(x)$ depending on $x \bmod m$ and $x \bmod n$ rather than $x \bmod mn$, which by the Chinese Remainder theorem are more or less equivalent, but I can't prove it.
I think I have a counter example:
Consider $f:\mathbb Z \to \mathbb Z, 6$-periodic $(6 = 2\cdot 3)$ with $f((0,1,2,3,4,5)) = (1,0,0,0,0,0)$
Claim: You cannot find a $g$ such that $f-g$ is $2$ periodic.
Assume we have $g$ $2$-periodic such that $f-g$ is $3$-periodic.
Then $1 - g(0) = (f-g)(0) = (f-g)(3) = 0-g(3) = 0-g(1)$, so $$g(1) = g(0)-1$$
Again $0-g(0) = 0-g(2) = (f-g)(2) = (f-g)(5) = 0-g(5) = 0-g(1)$ so we get $$g(0) = g(1),$$ a contradiction.