Math
Harmonic Number Calculator
The nth harmonic number is the sum 1 + 1/2 + 1/3 + ... + 1/n.
It grows without bound but painfully slowly, tracking ln(n) + 0.5772. Get H(n) as an exact fraction (for n up to 500), as a decimal for any n, and see how close the logarithmic approximation comes.
Exact fractions are shown for n up to 500; larger n gives a precise decimal.
Try an example
Result
H(n)
—
- Exact fraction
- —
- ln(n) + γ
- —
- Approximation error
- —
- Partial sums
- —
Student quick launch
Grade planning, algebra checks, and formulas students reach for most.
Study path
Use this calculator with
Follow these when you want the formula behind the answer, a short lesson, or nearby tools in the same topic.
What a harmonic number is
The harmonic numbers are the partial sums of the harmonic series. H(1) = 1, H(2) = 3/2, H(3) = 11/6, H(4) = 25/12, H(10) = 7381/2520 ≈ 2.929. They appear in the analysis of algorithms (quicksort, coupon collecting), in the average number of record highs in a random list, and in the book-stacking problem.
Small harmonic numbers
| n | H(n) exact | H(n) decimal | ln(n) + γ |
|---|---|---|---|
| 1 | 1 | 1 | 0.5772 |
| 2 | 3/2 | 1.5 | 1.2704 |
| 4 | 25/12 | 2.0833 | 1.9635 |
| 10 | 7381/2520 | 2.9290 | 2.8798 |
| 100 | (large fraction) | 5.1874 | 5.1824 |
| 1,000,000 | (large fraction) | 14.3927 | 14.3927 |
Why it diverges
Group the terms: 1/3 + 1/4 > 1/2, then 1/5 + ... + 1/8 > 1/2, then the next eight terms > 1/2, and so on. Each block adds at least 1/2, so the sum passes any number you name. But it takes about e^(N - γ) terms to exceed N: more than 10^43 terms to reach 100.
The logarithmic approximation
Comparing the sum with the area under 1/x gives H(n) ≈ ln(n). The leftover approaches the Euler-Mascheroni constant γ = 0.5772156649..., one of the famous constants whose irrationality is still unproven.
How to use it
- Enter n, the number of terms to add.
- Read H(n) as a decimal, and as an exact fraction when n ≤ 500.
- Compare with ln(n) + γ to see how well the The exponent you would need to raise a base to in order to get a number. tracks the harmonic sum.
How to read the answer
H(n) keeps growing forever, but each new term adds less, so it grows like a logarithm. The gap between H(n) and ln(n) settles at the Euler-Mascheroni constant γ ≈ 0.5772. H(n) is an integer only for n = 1.
Common mistakes and edge cases
- Assuming the harmonic series converges because the terms go to 0. It diverges, just very slowly.
- Confusing harmonic numbers with the harmonic mean.
- Adding decimals term by term and rounding each one; the exact fraction avoids accumulated error.
Worked examples
H(10)
7381/2520
H(n)
2.928968254
H(1)
Just the first term
H(n)
1
H(4)
25/12
H(n)
2.0833333333
H(100)
About 5.187
H(n)
5.1873775176
H(500)
Largest exact fraction shown
H(n)
6.79282343
H(1,000,000)
Decimal only, close to ln(n) + γ
H(n)
14.3927267229
Invalid
n must be at least 1
H(n)
Error
Frequently asked questions
What is the nth harmonic number?+
H(n) = 1 + 1/2 + 1/3 + ... + 1/n, the sum of the reciprocals of the first n positive integers.
Does the harmonic series converge?+
No. Even though the terms shrink to zero, the partial sums grow without bound, roughly like ln(n).
What is H(10)?+
7381/2520 ≈ 2.928968. It is the largest harmonic number that many textbooks still write as a fraction.
How is H(n) related to ln(n)?+
H(n) - ln(n) approaches the Euler-Mascheroni constant γ ≈ 0.5772 as n grows, so H(n) ≈ ln(n) + 0.5772 for large n.
Is any harmonic number besides H(1) an integer?+
No. For n ≥ 2, H(n) is never an integer; the highest power of 2 up to n cannot be cancelled from the denominator.
Where do harmonic numbers show up?+
In the expected number of comparisons in quicksort, the coupon collector problem (n H(n) draws on average), and how far a stack of blocks can overhang a table edge.
About this calculator
- Written by
- mathcheck editorial team
- Last reviewed
- September 4, 2026
Method
- Uses the values entered by the user and stable formulas documented on the page.
Related calculators
Sum of Series Calculator
Sum arithmetic and geometric series with the closed-form formulas, partial sums, and the infinite geometric series when |r| < 1, with a convergence check and step-by-step work.
Natural Log Calculator
Calculate the natural logarithm ln(x) or its inverse e^x, with exact answers for powers of e, the matching log₁₀ and log₂ values, series terms, and step-by-step work.
e Calculator
Get Euler's number e to any number of decimal places, compute e^x or the x-th root of e, and see the limit definition (1 + 1/n)^n and the series 1 + 1/1! + 1/2! + ... converge.
Fibonacci Calculator
Find the nth Fibonacci number exactly up to n = 10,000, list the first n terms, sum them, test whether a number is Fibonacci, and watch the ratios converge to the golden ratio with Binet's formula.
Geometric Series Calculator
Sum the first n terms of a geometric series or the whole infinite series when |r| < 1, with a convergence check, partial-sum table, the ratio-1 special case, and step-by-step work.
Complex Number Calculator
Add, subtract, multiply, divide, and raise complex numbers to powers exactly. Shows the modulus, argument in degrees and radians (with exact π fractions), conjugate, polar and exponential forms, De Moivre's theorem, and the point on the complex plane.
Last updated: September 4, 2026