Harmonic Number

Compute the nth harmonic number H(n) with this free online calculator. Get instant sums of reciprocal series up to any positive integer n for math and number theory.

Calculate

About This Calculator

The Harmonic Number Calculator computes the nth harmonic number H(n), defined as the sum of the reciprocals of the first n natural numbers: H(n) = 1 + 1/2 + 1/3 + ... + 1/n. This free online tool is ideal for students exploring number theory, series convergence, and the fascinating properties of the harmonic series, as well as for programmers analyzing algorithmic complexity and physicists modeling wave phenomena.

To calculate H(n), simply enter a positive integer n and click Calculate. The calculator sums the series term by term using a precise iterative method, displaying the result with 6 decimal places. For large n up to 1,000,000, the computation remains fast and efficient. The formula itself is straightforward: H(n) = Sigma{k=1}{n} 1/k.

Key Properties of Harmonic Numbers

  • Divergence: Although H(n) grows slowly, it increases without bound as n -> ∞. The growth rate is approximately ln(n) + gamma, where gamma ≈ 0.57721 (Euler-Mascheroni constant).
  • Never an integer: Except for n = 1, H(n) is never an integer. This is a classic result from Bertrand's postulate in number theory.
  • Fractional form: For small n, H(n) can be expressed as a rational number with denominator equal to the least common multiple of 1 through n.
  • Connection to the Riemann zeta function: The harmonic series is the special case ζ(1) of the Riemann zeta function, which diverges at s = 1.

Applications Across Disciplines

Harmonic numbers appear in numerous fields. In computer science, the average number of comparisons in quicksort is approximately 2n·H(n) - 4n. In physics, the harmonic series models standing waves in strings and pipes. In music theory, the harmonic series describes the overtone structure of musical notes. In probability, the coupon collector problem has an expected time of n·H(n). Students and professionals worldwide use this calculator for quick, accurate harmonic number computations.

Frequently Asked Questions

What is a harmonic number?

A harmonic number H(n) is the sum of the reciprocals of the first n natural numbers: H(n) = 1 + 1/2 + 1/3 + ... + 1/n. For example, H(5) = 1 + 1/2 + 1/3 + 1/4 + 1/5 = 137/60 ≈ 2.28333. Harmonic numbers are named after the harmonic series in music, where overtones follow a similar frequency ratio pattern.

Does the harmonic series converge?

No, the harmonic series does not converge. Even though each term 1/n gets smaller as n increases, the series diverges to infinity. This is because the terms do not shrink fast enough. For example, H(1000) ≈ 7.485, H(1000000) ≈ 14.393, and H(1012) ≈ 27.9. The harmonic number grows like the natural logarithm ln(n) plus the Euler-Mascheroni constant gamma ≈ 0.57721.

What is the 8th harmonic number?

The 8th harmonic number H(8) = 1 + 1/2 + 1/3 + 1/4 + 1/5 + 1/6 + 1/7 + 1/8 = 761/280 ≈ 2.71786. You can verify this by entering n = 8 into the calculator above.

What are harmonic numbers used for?

Harmonic numbers appear in number theory (studying divisor sums and the harmonic mean), analysis (estimating integrals via the Euler-Maclaurin formula), computer science (analyzing quicksort and other divide-and-conquer algorithms), and physics (modeling resonance and standing waves). The harmonic series also relates to the Riemann zeta function ζ(s) at s = 1.

Can n be a non-integer or a decimal?

Strictly speaking, harmonic numbers are defined only for positive integers n. However, harmonic numbers can be extended to non-integer values using the digamma function: H(x) = ψ(x + 1) + gamma, where ψ is the digamma function and gamma ≈ 0.57721 is the Euler-Mascheroni constant. This calculator supports positive integer n up to 1,000,000 for practical computation.

How does H(n) relate to the natural logarithm?

For large n, H(n) approximates ln(n) + gamma, where gamma ≈ 0.57721 is the Euler-Mascheroni constant. The difference H(n) - ln(n) approaches gamma as n increases. This relationship is used in analytic number theory and approximating sums of reciprocals.

What is the difference between harmonic number and harmonic series?

A harmonic number H(n) is the partial sum of the harmonic series up to n terms. The harmonic series is the infinite sum sum(1/k) from k = 1 to ∞, which diverges. H(n) represents the finite sum up to n terms, while the harmonic series is the limit as n -> ∞.