StatGardenREF. DESK
Calculators/Maths/Harmonic number
Maths

Harmonic number calculator

Sums the reciprocals of the first n positive integers to give the nth harmonic number.

Published 9 August 2026 · Updated 24 September 2026

What this calculator does

The nth harmonic number is 1 + 1/2 + 1/3 and so on down to 1/n. H₁₀ is about 2.9290. The terms shrink towards zero, which makes it tempting to assume the sum settles on some finite value, and it does not. The harmonic series diverges, climbing without limit as n grows.

It climbs extraordinarily slowly, though. Hₙ grows like the natural logarithm of n, so every tenfold increase in n adds only about 2.30 to the total. Passing 100 would take something on the order of 10⁴³ terms. That combination, certain to exceed any target but taking absurdly long to do it, is what makes harmonic numbers turn up in the analysis of algorithms and in problems such as the coupon collector.

The formula

FormulaHₙ = 1/1 + 1/2 + 1/3 + … + 1/n = Σₖ₌₁ⁿ 1/k

The reciprocals 1/1 through 1/n are added directly, one term at a time, for values of n up to 100,000. Alongside the exact sum the calculator shows ln(n) + γ, where γ is the Euler-Mascheroni constant of approximately 0.5772157. That expression is the standard approximation to Hₙ, and its error shrinks steadily as n grows.

TermMeaning
HₙThe nth harmonic number, the sum of the reciprocals of 1 through n.
Harmonic seriesThe infinite sum of all those reciprocals, which diverges despite its terms going to zero.
γ (Euler-Mascheroni constant)Approximately 0.5772157, the limiting difference between Hₙ and ln(n). Whether it is irrational is still an open question.
DivergenceGrowing without bound. The harmonic series diverges, so no ceiling exists no matter how many terms are added.

The inputs explained

FieldWhat to enter
n (positive integer)How many terms to sum, a positive whole number up to 100,000. The sum runs from 1/1 through to 1/n inclusive.

When to use it

Analysing an algorithm

The expected number of comparisons in quicksort, and the expected cost of several randomised algorithms, come out as harmonic numbers. Having Hₙ to hand turns an asymptotic result into an actual figure for a particular input size.

Working out a coupon collector problem

Collecting one of every item from a set of n, drawing at random each time, takes n·Hₙ draws on average. The harmonic number is the whole of the interesting part of that expression.

Demonstrating that slow growth is still divergence

Seeing Hₙ reach only about 12 after 100,000 terms, while still being guaranteed to pass any target eventually, makes the distinction between a shrinking term and a converging sum concrete.

Worked examples

Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.

How fast does the harmonic number grow?

Harmonic numbers at n = 1 and then at each power of ten up to 100,000.

Each row multiplies n by ten
nHarmonic number HₙApproximation ln(n) + γ
11.00000.577216
102.92902.8798
1005.18745.1824
1,0007.48557.4850
10,0009.78769.7876
100,00012.090112.0901
Each row multiplies n by ten and adds close to 2.30 to the total, which is ln(10): 2.9290, then 5.1874, then 7.4855, then 9.7876. The approximation is poor at n = 1, giving 0.577216 against a true value of 1, but by n = 10,000 the two agree to every decimal place shown here.

Questions

Does the harmonic series converge?

No, it diverges. The usual proof groups the terms into blocks ending at 1/2, 1/4, 1/8 and so on, each block summing to at least 1/2, so the total can be pushed past any target by taking enough blocks. Shrinking terms are necessary for convergence but nowhere near sufficient.

How many terms does it take for Hₙ to reach 10?

Between 12,000 and 13,000. H at 12,000 is 9.9699 and H at 13,000 is 10.0500, so the crossing happens in that gap. Reaching 20 would take somewhere around 270 million terms, since each further step of 1 multiplies the required n by e.

What is the Euler-Mascheroni constant?

It is the limit of Hₙ − ln(n) as n grows, approximately 0.5772157. It appears throughout analysis and number theory, and despite that, nobody has managed to prove whether it is rational or irrational.

Why do harmonic numbers appear in algorithm analysis?

Because they are what you get when a cost of 1/k arises at each of n stages, which happens naturally whenever something is chosen at random from a shrinking or growing pool. Quicksort pivots and the coupon collector problem both have that shape.

To sum an arithmetic or geometric run of terms instead, see the sum of series calculator. For the harmonic mean of a data set, a related but distinct use of reciprocals, see the geometric and harmonic mean calculator.