harmonic series calculator

Harmonic Number Calculator

Compute the partial sum of the harmonic series:

Hn = 1 + 1/2 + 1/3 + ... + 1/n
Enter a positive integer (for example: 10, 1000, or 1000000).

What is the harmonic series?

The harmonic series is one of the most famous infinite series in mathematics. Its terms are the reciprocals of positive integers: 1, 1/2, 1/3, 1/4, .... The running total after n terms is called the n-th harmonic number, written as Hn.

This calculator helps you compute Hn quickly and accurately. It also compares the result with the classic approximation ln(n) + γ, where γ (gamma) is the Euler-Mascheroni constant.

How to use this harmonic series calculator

  • Enter an integer value for n (the number of terms).
  • Choose a method:
    • Auto: picks a fast and accurate method based on the size of n.
    • Direct summation: adds each term 1/k from k = 1 to n.
    • Euler-Maclaurin approximation: excellent for very large n.
  • Select how many decimal places you want in the output.
  • Click Calculate Hn.

Key facts about harmonic numbers

1) Hn grows slowly

Harmonic numbers increase without bound, but very slowly. For large n, the growth is close to logarithmic: Hn ≈ ln(n) + γ.

2) The harmonic series diverges

Even though terms get tiny, the infinite sum does not settle to a finite value. This is a classic example of a divergent series in calculus.

3) Useful in many fields

Harmonic numbers appear in algorithm analysis, number theory, probability, and even physics. For example, average-case runtimes in some sorting and hashing analyses involve harmonic sums.

Quick intuition: To make Hn increase by about 1, you must multiply n by roughly e (about 2.718). That shows just how slowly it grows.

Examples

  • H1 = 1
  • H2 = 1 + 1/2 = 1.5
  • H5 = 1 + 1/2 + 1/3 + 1/4 + 1/5 = 2.28333...
  • H100 ≈ 5.18738
  • H1,000,000 ≈ 14.39273

Why this calculator offers two methods

For smaller inputs, direct summation is straightforward and very accurate. For very large inputs, approximation is dramatically faster and still highly precise. The auto mode combines the best of both approaches.

Frequently asked questions

Is the harmonic series the same as a geometric series?

No. Geometric series have a constant ratio between terms. The harmonic series uses reciprocals of integers, so the ratio changes term by term.

Can I calculate Hn for huge n?

Yes. Use Auto or Approximation mode for large n values to avoid long calculation times.

What does divergence mean here?

Divergence means that as n approaches infinity, Hn does not approach a fixed limit. It keeps increasing forever.

🔗 Related Calculators