Skip to main content
math

Harmonic Number Calculator

Calculate the nth harmonic number H(n) = 1 + 1/2 + 1/3 + … + 1/n, a fundamental quantity in number theory and analysis.

Reviewed by Chase FloiedUpdated

This free online harmonic number calculator provides instant results with no signup required. All calculations run directly in your browser — your data is never sent to a server. Enter your values below and see results update in real time as you type. Perfect for everyday calculations, homework, or professional use.

Compute H(n) = Σ 1/k for k=1 to n

How to Use This Calculator

1

Enter your input values

Fill in all required input fields for the Harmonic Number Calculator. Most fields include unit selectors so you can work in your preferred unit system — metric or imperial, whichever matches your problem.

2

Review your inputs

Double-check that all values are correct and that you have selected the right units for each field. Incorrect units are the most common source of calculation errors and can produce results that are off by factors of 2, 10, or more.

3

Read the results

The Harmonic Number Calculator instantly computes the output and displays results with units clearly labeled. All calculations happen in your browser — no loading time and no data sent to a server.

4

Explore parameter sensitivity

Try adjusting individual input values to see how the output changes. This is a quick and effective way to develop intuition about how different parameters influence the result and to identify which inputs have the largest effect.

Formula Reference

Harmonic Number Calculator Formula

See calculator inputs for the governing equation

Variables: All variables and their units are labeled in the calculator interface above. Input fields accept values in multiple unit systems — select your preferred unit from the dropdown next to each field.

When to Use This Calculator

  • Use the Harmonic Number Calculator when you need a quick mathematical result without writing out all the steps manually, saving time on repetitive calculations.
  • Use it to verify hand calculations on tests or assignments and catch arithmetic mistakes.
  • Use it when teaching or explaining mathematical concepts to others, demonstrating how changing inputs affects the result.
  • Use it to explore the behavior of mathematical functions across a range of inputs.

About This Calculator

The Harmonic Number Calculator is a free mathematical calculation tool for students, educators, and professionals who need quick, reliable results. Calculate the nth harmonic number H(n) = 1 + 1/2 + 1/3 + … + 1/n, a fundamental quantity in number theory and analysis. The underlying algorithms implement well-established mathematical formulas and numerical methods. Results are computed instantly in the browser. This tool is useful for learning, verification of hand calculations, and rapid exploration of mathematical relationships. All computation happens locally — no data is sent to a server.

About Harmonic Number Calculator

The harmonic numbers are the partial sums of the harmonic series: H(n) = 1 + 1/2 + 1/3 + … + 1/n. Despite their simple definition, harmonic numbers are remarkably important in mathematics and computer science. They appear in the analysis of sorting algorithms (quicksort's expected comparisons involve H(n)), the coupon collector's problem, random permutations, and the distribution of prime numbers. The harmonic series itself diverges — H(n) grows without bound as n increases — but it does so extremely slowly, growing as ln(n) + γ where γ ≈ 0.5772 is the Euler–Mascheroni constant. This slow divergence means that even H(10^100) is only about 230.8. Harmonic numbers connect to the Riemann zeta function (ζ(1) diverges), the digamma function (ψ(n+1) = H(n) − γ), and Stirling numbers. This calculator computes exact harmonic numbers alongside the logarithmic approximation so you can see how accurate the asymptotic formula is.

The Math Behind It

H(n) satisfies the recurrence H(n) = H(n−1) + 1/n with H(1) = 1. The asymptotic expansion is H(n) = ln(n) + γ + 1/(2n) − 1/(12n²) + 1/(120n⁴) − … where γ is the Euler–Mascheroni constant. Generalized harmonic numbers are H(n,m) = Σ 1/k^m for k=1 to n; for m > 1 these converge as n → ∞ to the Riemann zeta function ζ(m). The alternating harmonic series 1 − 1/2 + 1/3 − 1/4 + … converges to ln(2). Harmonic numbers appear in the expected number of coupons needed to complete a collection (n × H(n)) and in the analysis of the quicksort algorithm. The integral representation is H(n) = ∫₀¹ (1 − xⁿ)/(1 − x) dx. No harmonic number beyond H(1) = 1 is an integer.

Formula Reference

Harmonic Number

H(n) = Σ (1/k) for k = 1 to n

Variables: n = upper limit

Asymptotic Approximation

H(n) ≈ ln(n) + γ + 1/(2n)

Variables: γ ≈ 0.5772 (Euler–Mascheroni constant)

Worked Examples

Example 1: Compute H(5)

Find H(5) = 1 + 1/2 + 1/3 + 1/4 + 1/5.

Step 1:H(5) = 1 + 0.5 + 0.3333… + 0.25 + 0.2
Step 2:H(5) = 60/60 + 30/60 + 20/60 + 15/60 + 12/60
Step 3:H(5) = 137/60

H(5) = 137/60 ≈ 2.2833

Common Mistakes & Tips

  • !Assuming the harmonic series converges — it diverges, albeit very slowly.
  • !Using the approximation ln(n) + γ for small n where the error is significant.
  • !Confusing harmonic numbers H(n) with harmonic means.

Related Concepts

Used in These Calculators

Calculators that build on or apply the concepts from this page:

Frequently Asked Questions

Does the harmonic series converge?

No. The harmonic series diverges, meaning H(n) → ∞ as n → ∞, but it grows very slowly — approximately as ln(n) + 0.5772.

What is the Euler–Mascheroni constant?

γ ≈ 0.5772156649 is defined as the limit of H(n) − ln(n) as n → ∞. It is not known whether γ is rational or irrational.