Advanced

Harmonic Number Calculator — H(n)

Calculate the nth harmonic number H(n) — the sum of the first n reciprocals 1 + 1/2 + … + 1/n — along with its asymptotic approximation using the Euler–Mascheroni constant.
H(n) = 1 + 1/2 + 1/3 + … + 1/n
Harmonic Number H(n)
2.92896825

Exact sum: 1 + 1/2 + 1/3 + … + 1/n

n
10
H(n) exact
2.92896825
Asymptotic approx. ln(n) + γ
2.92896742
Euler–Mascheroni constant γ
0.57721566
Approximation error
0.0000008294
1222223333Partial sums H(1), H(2), … H(20) — growing ever more slowly
Results are estimates for general information only and are not professional advice — always verify important results independently before relying on them. Read the full disclaimer.
Quick answer

How does this calculator work?

H(n) = 1 + 1/2 + 1/3 + … + 1/n grows like ln(n) + 0.5772… (the Euler–Mascheroni constant). For n=10: H(10) ≈ 2.9290. For n=100: H(100) ≈ 5.1874. The series diverges but very slowly — it first exceeds 10 only around n ≈ 12 367.

Formula
H(n) = Σ(k=1 to n) 1/k ≈ ln(n) + γ + 1/(2n) − 1/(12n²)
How this is calculated

The nth harmonic number H(n) is defined as the finite sum of unit fractions from 1 to 1/n: H(n) = 1 + 1/2 + 1/3 + ⋯ + 1/n. This calculator computes it by direct summation (accurate for any integer n up to 100 000). The terms 1/k decrease rapidly at first but slow down, so the partial sums grow without bound — the series diverges — but extremely slowly: H(n) doubles in size roughly every time n is squared.

For large n, direct summation becomes slow, so mathematicians use the asymptotic expansion H(n) ≈ ln(n) + γ + 1/(2n) − 1/(12n²) + …, where γ ≈ 0.5772… is the Euler–Mascheroni constant, defined as the limiting difference between H(n) and ln(n). This approximation is remarkably accurate: for n = 100 the error is less than 10⁻⁸. The calculator shows both the exact sum and the approximation so you can see how well they agree.

Harmonic numbers appear in the analysis of algorithms (quicksort and hash tables), coupon-collector problems ("how many packs until you complete the set?"), special values of the Riemann zeta function, and the generalised harmonic numbers used in analytic number theory.

Frequently asked questions

No. The harmonic series Σ(1/k) from k = 1 to ∞ diverges — its sum grows without bound. The growth is very slow (roughly ln n), so for practical n the partial sums look nearly stationary, but they are provably unbounded. The classic proof groups terms: 1/2 ≥ 1/2; 1/3 + 1/4 > 1/2; 1/5 + 1/6 + 1/7 + 1/8 > 1/2; and so on, forming infinitely many groups each exceeding 1/2.

γ ≈ 0.5772156649… is the limit of H(n) − ln(n) as n → ∞. It measures the persistent gap between the harmonic partial sums and the natural logarithm. It appears throughout number theory and analysis; whether it is rational or irrational is an unsolved problem.

In the average-case analysis of quicksort, the expected number of comparisons is ≈ 2n ln n = 2n × H(n) / log base. In the coupon-collector problem, the expected number of draws to collect all n distinct coupons is n × H(n). Hash table expected search lengths also involve H(n).

Also known as

harmonic number h(n) calculator
sum of reciprocals 1 to n
euler mascheroni constant calculator
partial sum harmonic series
h(n) formula calculator
ln n plus gamma approximation
harmonic series nth term sum
divergent series partial sum

APA

TG we-Calculate Editorial Team. (2026). Harmonic Number Calculator — H(n) [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/harmonic-number-calculator

Chicago

TG we-Calculate Editorial Team. "Harmonic Number Calculator — H(n)." TG we-Calculate. 2026. https://we-calculate.com/calculator/harmonic-number-calculator.

IEEE

TG we-Calculate Editorial Team, "Harmonic Number Calculator — H(n)," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/harmonic-number-calculator

BibTeX

@misc{wecalculate_harmonic_number_calculator, title = {Harmonic Number Calculator — H(n)}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/harmonic-number-calculator}}, year = {2026}, note = {TG we-Calculate} }

Did this calculator help you?