# The Programmatic Side of Mathematica III: The Harmonic Series

I love prime numbers, but I also love summations. For example, the harmonic series, you might know to be the infinite sum:

$latex \sum_{m=1}^n \frac{1}{m}&s=3$

The sum converges slowly to infinity. I set up a function in Mathematica:

Nharmonic[n_] := NSum[1/m, {m, 1, n}]

which gave as the first three numbers of the series (expressed as decimals):

1, 1.5, 1.8333

which would seem to indicate some kind of increasing trend, but passing a number like

Nharmonic[10^9]

21.3005

told me that this is one heck of a slowly increasing function. Wolfram’s Mathworld says that the Euler-Mascheroni constant, γ, which can be computed by taking the difference between

Nharmonic[n] - N[Log[n]].

γ is a nonrepeating decimal which has been computed to over 10 billion decimal places some time after 2006. The Mathematica site also says that you can find γ to one billion digits if you let it run on average hardware for close to 2 days.