Skip to main content
4 of 4
Commonmark migration

Mathematica 7.0.1 says that Sum[1/(k*Length[Divisors[k]]), {k, 1, n}] is the harmonic number $H_n$, which is clearly wrong. The correct answer is at An elementary number theoretic infinite series


Edit:

This is less a bug and more a misunderstanding of how to use Mathematica. The culprit is that Length[Divisors[k]] for k without a value evaluates to 1 (which is consistent with how Mathematica structurally treats expressions). The correct way to express the sum is

Sum[1/(k DivisorSigma[0, k]), {k, 1, n}]

which, as expected, now remains unevaluated.

rgrig
  • 1.4k
  • 1
  • 16
  • 19