Audited 29 Jul 2026·Last updated 31 Jul 2026·4 citations·Tier 3·0 uses

Harmonic Number Calculator

Compute Hn = 1 + 1/2 + 1/3 + … + 1/n exactly, and compare it against the ln n + γ asymptotic estimate. Not the harmonic mean — this is the partial sum.

Harmonic Number Calculator

Adds 1 + 1/2 + 1/3 + … + 1/n. Every term up to n = 25,000 is summed exactly; above that the Euler–Maclaurin estimate is used and labelled.
Harmonic number (Hn)
2.929
The sum 1 + 1/2 + 1/3 + … + 1/n, shown to 10 decimal places.
Estimate: ln n + γ + 1/(2n) − 1/(12n²)
2.929
Exact minus estimate
0
ln n
2.3026
How this was computed
Summed all 10 terms exactly, one at a time.

Background.

The nth harmonic number, written Hn, is what you get by adding the reciprocals of the whole numbers up to n: Hn = 1 + 1/2 + 1/3 + … + 1/n. This calculator returns that sum, alongside the classical estimate ln n + γ + 1/(2n) − 1/(12n²) and the gap between them, so you can see for yourself how quickly the approximation becomes indistinguishable from the real thing.

One thing to settle before you read the number: this is not the harmonic mean. The harmonic mean takes a dataset you supply and returns a central value, n divided by the sum of the reciprocals of your values. A harmonic number takes a single index and returns a running total over the first n positive integers. The two share a reciprocal and nothing else. There is exactly one line connecting them worth knowing — the harmonic mean of the numbers 1, 2, …, n equals n ⁄ Hn — and if it is an average you want, the harmonic mean calculator is the page you need.

Harmonic numbers matter because the harmonic series diverges, but does it maddeningly slowly. Adding terms forever gets you to infinity; adding twelve thousand of them barely gets you past 10. That behaviour is why Hn turns up in the average-case cost of quicksort, in the coupon-collector problem, and in the analysis of self-balancing structures — anywhere a cost accumulates as 1/k over k steps. The growth rate is captured exactly by the constant that appears in the estimate above: γ, the Euler–Mascheroni constant, which NIST's Digital Library of Mathematical Functions defines as the limit of Hn − ln n and gives as 0.57721566490153286060.

Because the sum has no closed form, this page tells you plainly which method produced your answer. Up to n = 25,000 every term is added one at a time at full decimal precision. Above that the three-term expansion is used instead, because summing a hundred thousand terms takes long enough to stall a browser, and by then the expansion's first dropped term is around 10⁻²⁰ — twenty orders of magnitude smaller than the last digit shown. The method line sits beside the result, not inside a collapsed FAQ.

What is harmonic number calculator?

A harmonic number Hn is the partial sum of the harmonic series: Hn = Σ from k = 1 to n of 1/k, so H1 = 1, H2 = 1.5, H3 ≈ 1.8333, H10 = 7381/2520 ≈ 2.92897. Wolfram MathWorld gives this definition and the asymptotic expansion Hn ~ ln n + γ + 1/(2n) − (1/12)n⁻² + (1/120)n⁻⁴ − … as well as the analytic identity Hn = γ + ψ₀(n+1) relating harmonic numbers to the digamma function. NIST's DLMF states the same identity as ψ(n+1) = Σ 1/k − γ at equation 5.4.14. The series itself diverges — its partial sums grow without bound — but only logarithmically, which is why Hn is small even for very large n. Harmonic numbers are defined only at whole-number n; the natural extension to fractional arguments is the digamma function, which this page does not cover.

How to use this calculator.

  1. Enter how many terms you want to add. The calculator sums 1 + 1/2 + 1/3 up to 1/n.
  2. Read Hn as the main result, then compare it against the ln n + γ estimate shown beside it.
  3. Check the method line to see whether the value was summed exactly or approximated — the calculator switches at n = 25,000 and tells you which branch ran.
  4. If what you actually wanted was the harmonic mean of your own list of numbers, use the harmonic mean calculator instead — it answers a different question.

The formula.

Hₙ = 1 + 1⁄2 + 1⁄3 + … + 1⁄n ≈ ln n + γ + 1⁄(2n) − 1⁄(12n²)

There is no closed form for Hn, so the exact value has to be summed term by term. This calculator does that at full decimal precision, with no rounding during accumulation and a single rounding to 10 decimal places at the end. For n = 10 the arithmetic is small enough to check by hand: put every term over 2520, the least common multiple of 1 through 10, giving numerators 2520, 1260, 840, 630, 504, 420, 360, 315, 280 and 252, which total 7381 — so H10 = 7381/2520 = 2.9289682540. The estimate beside it comes from the Euler–Maclaurin expansion, ln n + γ + 1/(2n) − 1/(12n²), truncated after the 1/(12n²) term. At n = 10 that gives 2.9289674246, which falls 8.294 × 10⁻⁷ short of the exact value — and the first term the truncation dropped, +1/(120n⁴) = 1/1,200,000 = 8.333 × 10⁻⁷, accounts for essentially all of that gap, which is a useful reassurance that both the expansion and its implementation are right. The constant γ is entered as exactly the twenty significant digits NIST's DLMF prints at equation 5.2.3 and no more; none are invented. Above n = 25,000 the expansion replaces the exact sum, because adding a hundred thousand reciprocals is too slow to do on every keystroke while the expansion's truncation error at that point is roughly 2 × 10⁻²⁰. In that branch the estimate is the answer, so the exact-minus-estimate output reads 0 by construction, and the method line beside the result says so rather than leaving you to infer it.

A worked example.

Example

Ask for ten terms. The calculator adds 1 + 1/2 + 1/3 + 1/4 + 1/5 + 1/6 + 1/7 + 1/8 + 1/9 + 1/10 and the harmonic number output reads 2.928968254 — which is exactly 7381/2520, as you can confirm by putting every term over 2520 and adding the numerators 2520 + 1260 + 840 + 630 + 504 + 420 + 360 + 315 + 280 + 252 = 7381. The ln n output is 2.302585093, and the estimate output adds γ and the two correction terms to reach 2.9289674246. The exact-minus-estimate output is therefore 0.0000008294 — the estimate is short by less than a millionth after only ten terms, and that shortfall is almost exactly the size of the first term the expansion leaves out, 1/(120 × 10⁴) = 0.00000083. The method line confirms that all ten terms were summed exactly rather than estimated.

n10

Frequently asked questions.

Is a harmonic number the same as a harmonic mean?
No. A harmonic number is the running total 1 + 1/2 + 1/3 + … + 1/n over the first n whole numbers — a sum that grows without bound. A harmonic mean is an average of a dataset you supply, computed as n divided by the sum of the reciprocals of your values, and it always sits between the smallest and largest of them. The only link worth knowing is that the harmonic mean of the numbers 1, 2, …, n equals n ⁄ Hn. For averages, use the harmonic mean calculator.
Does the harmonic series diverge?
Yes, but extraordinarily slowly. The partial sums grow without any upper bound, so the series diverges — but they grow like ln n, which means Hn first passes 10 at n = 12,367 and would need roughly 2.7 × 10⁸ terms to pass 20. That is why harmonic numbers stay small-looking even for enormous n. The integral test in OpenStax Calculus Volume 2 §5.3 is the standard proof.
What is γ, the constant in the estimate?
The Euler–Mascheroni constant, defined as the limit of Hn − ln n as n grows. NIST's Digital Library of Mathematical Functions gives it at equation 5.2.3 as 0.57721566490153286060. It is the fixed gap that opens up between the harmonic number and the logarithm, and it is why ln n alone is not a good estimate of Hn while ln n + γ is.
Why does the calculator change method above 25,000 terms?
Because adding a hundred thousand reciprocals at full decimal precision takes about a third of a second, which is too slow to run on every keystroke, while the Euler–Maclaurin expansion is already accurate to roughly 20 decimal places at that size. Rather than switching quietly, the page states which method produced your number. At the switch point the two methods agree to all ten decimal places shown, so the change is invisible in the result.
Can I get Hn for a fractional n?
Not on this page. Harmonic numbers are defined as a sum of whole-numbered terms, and the calculator rejects a fractional index rather than guessing what you meant. The natural extension to fractional and complex arguments is the digamma function, related to harmonic numbers by Hn = γ + ψ₀(n+1), which is outside this page's scope.

In this category

Embed

Quanta Pro

Paid features are coming later.

  • All 977 calculators remain free
  • No billing is enabled
Coming soon