Does anyone know how to write a program in Python that will calculate the addition of the harmonic series. i.e. 1 + 1/2 +1/3 +1/4...
This ought to do the trick.
def calc_harmonic(n): return sum(1.0/d for d in range(2,n+1))