any time is even, this term evaluates to zero, as you observed. The only remaining terms will be those for which is odd. The values of do not matter for even , because they're being multiplied by zero. However, with
this changes. Now, the values of will affect the result regardless of whether is even or odd.
The rest of your work looks good to me, but I admit that I only gave a quick look through it.