Question: For reference see this post in MSE. I noticed on WolframAlpha the summation $\sum_{k=1}^{n}\frac{\cos(\pi > k)}{\csc(\pi k)}$ returns the result $\phi(n)$; which is the Euler phi function. Of course this summation should equal zero. A commentator suggested it might be bug in WolframAlpha as the Mathematica code: Sum[Cos[Pi k]/Csc[Pi k], {k, 1, n}] returns 0. At least this was the case running on Windows 10, x86, running version Another commentator showed the same code returns EulerPhi[n] running version on macOS. Is this a bug in Mathematica?

  • 3
    $\begingroup$ The code correctly returns zero in the current version, so there's no bug. I also get EulerPhi[n] in V12.0, so there was a bug. $\endgroup$
    – Michael E2
    Sep 9, 2020 at 18:33
  • $\begingroup$ @MichaelE2 might you answerize that so I can accept your answer. Any guess what might be going on in WolframAlpha or in prior versions ? $\endgroup$ Sep 9, 2020 at 18:34

1 Answer 1


Version V12.1.1:

Sum[Cos[Pi k]/Csc[Pi k], {k, 1, n}] 
(*  0  *)

Version V12.0.0:

Sum[Cos[Pi k]/Csc[Pi k], {k, 1, n}] 
(*  EulerPhi[n]  *)

It seems there was a bug in the earlier version of V12. It's possible that Wolfram|Alpha is using V12.0 (but questions about the workings of W|A are off-topic on this site).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.