Harmonic Series Calculator - H_n and Asymptotic Estimate

Use the harmonic series calculator to read the partial sum H_n, the nth term 1/n, the asymptotic ln(n) + gamma approximation, and the absolute error.

Updated: June 19, 2026 • Free Tool

Harmonic Series Calculator

Must be a positive integer. Larger n gives a closer match to the asymptotic ln(n) + gamma approximation.

Results

Partial sum H_n
0
nth term 1/n 0
Asymptotic ln(n) + gamma 0
|H_n - (ln(n) + gamma)| 0
First terms preview 0

What Is Harmonic Series Calculator?

A harmonic series calculator returns the partial sum H_n = 1 + 1/2 + 1/3 + ... + 1/n of the harmonic series for any positive integer n, plus the asymptotic ln(n) + gamma.

  • Compute the partial sum of the first n reciprocals: Type n to read H_n without manually adding reciprocals.
  • Compare the partial sum to the asymptotic curve: Read H_n alongside ln(n) + gamma to see how close the running total sits to the natural log plus the Euler-Mascheroni constant.
  • Demonstrate the divergence of the harmonic series: Run n up to 1000 or 10000 to show that H_n keeps climbing without settling to a finite value.
  • Check the size of the last added term: Use the 1/n row to confirm that each new term shrinks but does not become zero.

The harmonic series is the sum of reciprocals 1 + 1/2 + 1/3 + ... and is the textbook example of a series whose terms shrink to zero but whose partial sums still diverge to infinity.

The calculator answers the four numbers every user actually wants: H_n itself, the asymptotic ln(n) + gamma, the absolute gap between them, and the nth term 1/n.

For exact-rational H_n or the generalized H_n(r) at any order r, the Harmonic Number Calculator in Math & Conversion runs the same series with rational arithmetic and the generalized exponent.

How Harmonic Series Calculator Works

Internally the calculator loops from k = 1 to n and accumulates 1/k into a running total. The asymptotic row uses ln(n) plus the Euler-Mascheroni constant gamma = 0.5772156649. The absolute error row is the gap between the exact sum and that approximation.

H_n = sum_{k=1}^{n} 1/k asymptotic ~ ln(n) + gamma
  • n: Number of terms to sum. Must be a positive integer; the form caps n at 10000.
  • H_n: Partial sum of the harmonic series, the running total of the first n reciprocals.
  • 1/n: The nth term, also the last term added when computing H_n.
  • ln(n): Natural logarithm of n, the leading-order growth term in the asymptotic expansion.
  • gamma: Euler-Mascheroni constant, equal to 0.5772156649. The offset between H_n and ln(n) for large n.

Wolfram MathWorld publishes the partial sum H_n = sum_{k=1}^{n} 1/k and the asymptotic expansion H_n = ln(n) + gamma + 1/(2n) - 1/(12n^2) + ... as the defining identities of the harmonic series, and Wikipedia repeats the partial-sum definition because it is the standard counterexample to the (false) idea that any series with shrinking terms must converge.

The loop runs in O(n) time, so for the cap of 10000 the calculation is fast in the browser.

Partial sum for n = 10

n = 10

H_10 = 1 + 0.5 + 0.333333 + 0.25 + 0.2 + 0.166667 + 0.142857 + 0.125 + 0.111111 + 0.1 = 2.9289682539682538; ln(10) + gamma = 2.302585093 + 0.5772156649 = 2.879800758

H_10 = 2.9289682539682538, asymptotic = 2.8798007579, |error| = 0.0491674961

The first 10 reciprocals already sum to almost 3, and the asymptotic approximation underestimates H_n by about 0.049. The error shrinks as n grows.

Asymptotic closeness at n = 1000

n = 1000

H_1000 = 7.485470860550344; ln(1000) + gamma = 6.907755279 + 0.5772156649 = 7.484970944

H_1000 = 7.485470860550344, asymptotic = 7.4849709439, |error| = 0.0004999167

At n = 1000 the asymptotic approximation is within 0.0005 of the exact partial sum, matching the 1/(2n) leading error term.

According to Wikipedia (Harmonic series), the harmonic series partial sum H_n = 1 + 1/2 + 1/3 + ... + 1/n diverges as n grows, and H_10 = 7381 / 2520 = 2.9289682539682538

According to Wolfram MathWorld, the nth term of the harmonic series is a_n = 1/n, and the partial sum grows asymptotically as H_n = ln(n) + gamma + 1/(2n) - 1/(12n^2) + ... where gamma = 0.5772156649 is the Euler-Mascheroni constant

Factorials are the second classic series used alongside the harmonic series, and Factorial Calculator returns n! for the same positive-integer inputs.

Key Concepts Explained

These four ideas are enough to interpret every number the harmonic series calculator shows.

Reciprocal partial sum H_n

H_n = 1 + 1/2 + 1/3 + ... + 1/n is the running total of the first n reciprocals. The calculator computes it in one pass and prints it to 10 decimal places.

Euler-Mascheroni constant gamma

gamma = 0.5772156649 is the limit of H_n - ln(n) as n grows. It is the offset that turns the natural log curve into a tight approximation of the partial sum.

Asymptotic expansion H_n ~ ln(n) + gamma + 1/(2n) - ...

The expansion adds a 1/(2n) correction term that explains why the absolute error shrinks like 1/(2n) as n grows. At n = 10 the error is about 0.049; at n = 1000 it is about 0.0005.

Divergence of the series

Even though 1/n shrinks to zero, H_n grows without bound. The calculator makes this visible by pushing n to 1000 or 10000 and watching H_n keep climbing.

These four ideas are the bridge between the partial sum table in a textbook and the asymptotic curve the calculator prints next to it. Once you know gamma and the 1/(2n) correction, the absolute-error row is no longer a mystery: it should roughly halve whenever you quadruple n.

The same logarithmic unbounded growth is what makes the harmonic series a useful test case in calculus, probability, and algorithm analysis.

The arithmetic sequence is the additive sibling of the harmonic series, and Arithmetic Sequence Calculator returns a_n and S_n with the same n-th term pattern.

How to Use This Calculator

Five short steps cover every workflow this calculator supports, from a homework problem to a divergence demonstration.

  1. 1 Type the number of terms: Enter a positive integer n. Values up to 10000 work; values above 1000 are good for divergence demos.
  2. 2 Read the partial sum H_n: The top row prints the exact partial sum to 10 decimal places. For n = 10 it reads 2.9289682539682538.
  3. 3 Read the nth term: The 1/n row shows the last term added. For n = 1000 it reads 0.001.
  4. 4 Read the asymptotic and the error: The ln(n) + gamma row is the leading-order approximation. The |error| row shrinks like 1/(2n) as n grows.
  5. 5 Scan the first terms preview: The bottom row prints the first min(n, 20) terms as a comma-separated list.

To demonstrate divergence in a calculus class, set n = 10000 and read H_10000 = 9.7876060360 next to the asymptotic ln(10000) + gamma = 9.7875560369. The gap to the asymptotic curve is about 0.00005, matching the 1/(2n) = 1/20000 leading correction term, which is exactly the behavior the integral test predicts.

To see why the harmonic series diverges while a geometric series with ratio r < 1 converges, Geometric Sequence Calculator runs the multiplicative counterpart with the same n-th term closed form.

Benefits of Using This Calculator

The calculator removes the loop you would otherwise write by hand and pairs the exact sum with the asymptotic curve that explains why it grows the way it does.

  • Exact partial sum up to 10000 terms: The calculator loops through 1/k in JavaScript float64 and prints H_n to 10 decimal places, so n = 1000 or n = 10000 give a precise answer without an external script.
  • Asymptotic approximation side by side: H_n and ln(n) + gamma print on the same screen, which makes the absolute error row meaningful.
  • Built-in divergence demonstration: Pushing n to 10000 makes it obvious that the partial sum does not settle to a finite value.
  • Domain error for non-positive-integer n: If n is not a positive integer (n = 0, negative, or fractional), the calculator returns a clear error message instead of a NaN.
  • Pairs with the Harmonic Number Calculator: For exact rational H_n or generalized H_n(r), the harmonic-number-calculator in Math & Conversion handles the same series with rational arithmetic and the generalized order.

If you are working through a homework problem and want to confirm the partial sum of the first 10 reciprocals, the calculator removes the chance of arithmetic slips and gives you 10 decimal places of precision.

The asymptotic row is the same approximation that probability textbooks use to estimate H_n for n in the millions; reading it next to the exact value is the clearest way to see why the approximation works.

For the reciprocal average of a list of values rather than the sum of reciprocals, Harmonic Mean Calculator returns the harmonic mean of the same kind of input list.

Factors That Affect Your Results

Three things determine what the result looks like, plus two caveats about behavior at the boundaries.

Magnitude of n

H_n grows like ln(n) + gamma, so increasing n from 10 to 100 adds about 2.30. The relative contribution of each new term shrinks, which is why the absolute error against the asymptotic also shrinks.

Distance from the asymptotic

At n = 1 the absolute error is about 0.4228 (H_1 = 1 vs gamma = 0.5772). At n = 1000 it is about 0.0005. The error roughly halves every time n quadruples, which matches the 1/(2n) leading correction term.

Whether n is a positive integer

The partial sum is only defined for positive integers. Non-positive or fractional n triggers a domain error and the calculator does not produce a numeric result.

Float64 precision at large n

JavaScript's float64 keeps about 15-17 significant digits, so H_n stays exact within roughly 1e-10 relative error up to n = 10000. Beyond that, accumulate-into-double can lose a few digits and a BigInt-based accumulator would be needed.

    The asymptotic approximation is only a leading-order estimate. The actual H_n sits about 1/(2n) above the curve, so for small n (n = 1 or n = 2) the error is large and the approximation is not useful as a substitute for the exact sum.

  • The calculator is scoped to the classical harmonic series with exponent p = 1. It does not handle generalized harmonic numbers of order r (sum of 1/k^r), which converge for r > 1; use the harmonic-number-calculator in Math & Conversion for that.

H_n is dimensionless: it is a pure count, not a currency or a percentage. If your problem reports the sum in another unit, multiply by the unit factor after the calculation.

If the absolute error looks larger than expected for your n, check that you are comparing H_n against ln(n) + gamma rather than ln(n + 1). The textbook sometimes uses H_n ~ ln(n + 1) + gamma instead, which is offset by about 1/n relative to the version used here.

According to Wikipedia (Euler's constant), the Euler-Mascheroni constant gamma = 0.5772156649015329 is the limit of H_n - ln(n) as n grows, and it appears as the constant offset in the asymptotic expansion H_n = ln(n) + gamma + 1/(2n) - ...

To put the harmonic series next to a series that does have a closed-form partial sum, Sum of Series Calculator returns the nth term, partial sum, and full term list for any arithmetic or geometric series with the same n-th term pattern.

harmonic series calculator showing the partial sum H_n, the nth term, the asymptotic ln(n) + gamma approximation, and the absolute error between them
harmonic series calculator showing the partial sum H_n, the nth term, the asymptotic ln(n) + gamma approximation, and the absolute error between them

Frequently Asked Questions

Q: What is the harmonic series?

A: The harmonic series is the infinite sum 1 + 1/2 + 1/3 + 1/4 + ... of reciprocals of the positive integers. Its partial sums H_n = 1 + 1/2 + ... + 1/n grow without bound even though each new term 1/n shrinks toward zero. The harmonic series calculator returns H_n for any positive integer n.

Q: What is the formula for the sum of the first n terms of the harmonic series?

A: The partial sum is H_n = sum_{k=1}^{n} 1/k, with no simpler closed form for general n. For n = 10 the exact value is H_10 = 7381 / 2520 = 2.9289682539682538, and for n = 100 the value is H_100 = 5.1873775176396203. The calculator prints H_n to 10 decimal places for any positive integer n up to 10000.

Q: Does the harmonic series converge or diverge?

A: The harmonic series diverges to infinity. Even though each new term 1/n shrinks toward zero, the partial sums H_n grow like ln(n) + gamma and outgrow any finite bound. Pushing n to 1000 or 10000 in the calculator makes the divergence visible: H_1000 = 7.4855 and H_10000 = 9.7876, both well above any preset target.

Q: What is the harmonic series approximation ln(n) + gamma?

A: The asymptotic approximation H_n ~ ln(n) + gamma uses the natural logarithm of n plus the Euler-Mascheroni constant gamma = 0.5772156649. It is the leading-order term in the full expansion H_n = ln(n) + gamma + 1/(2n) - 1/(12n^2) + ... and gets tighter as n grows: at n = 1000 the absolute error is about 0.0005, and at n = 10000 it is about 0.00005.

Q: What is the nth term of the harmonic series?

A: The nth term is 1/n. For n = 10 it is 0.1; for n = 100 it is 0.01; for n = 1000 it is 0.001. The harmonic series calculator prints 1/n in its own row so you can confirm the last term added in the partial sum and check that the terms are shrinking toward zero without reaching it.

Q: How is the harmonic series different from a harmonic mean?

A: The harmonic series is a sum of reciprocals H_n = 1 + 1/2 + 1/3 + ... + 1/n, while a harmonic mean is a reciprocal average of a list of values: H = n / (1/x_1 + 1/x_2 + ... + 1/x_n). The names share the word harmonic but the formulas are different. For a harmonic mean across a list of numbers, the harmonic mean calculator in Math & Conversion is the right tool.