Prove that if are arbitrary integers then the expression:
is equal to:
when is divisible by and is not,
when is divisible by and is not,
when both and are divisible by or not divisible by .
Start by using the trig formula . That gives
You can sum the cosine series using (geometric series).
I'll leave it to you to take it from there. I haven't tried to complete the calculation, but my gut feeling is to be suspicious of the claimed result. I would expect the answer to depend on whether and 2p have a nontrivial common divisor, rather than whether they are divisible by 2p. But I may well be wrong about that.
Notice that if then and equivalently, if then
From the equation:
It is immediately apparent that condition 3 holds, as both cosine terms are actually for some k, which is zero regardless of r.
So, condition 2 translates to: for all m,n,p for
Likewise condition 1 becomes: for all m,n,p for
This should greatly simplify the geometric series step.