Harmonic Number Calculator

Harmonic Number Calculator

Emerging AI Skill PRO

Enter Calculation

Formula

Hn=∑k=1n1k=1+12+13+⋯+1nH_{\text{n}} = \sum_{k=1}^{\text{n}} \frac{1}{k} = 1 + \frac{1}{2} + \frac{1}{3} + \cdots + \frac{1}{\text{n}}
Usage stats

Advertisement

Results

Harmonic Number H(n)
2.928968
sum of 1/k for k = 1 to n
Number of terms (n) 10
Harmonic number 2.928968254

Report an error on this page

What is a Harmonic Number?

The nth harmonic number, written \(H(n)\), is the sum of the reciprocals of the first n positive integers: $$H(n) = 1 + \frac{1}{2} + \frac{1}{3} + \cdots + \frac{1}{n}.$$ It is the partial sum of the famous harmonic series, one of the most important slowly-diverging series in mathematics. Although each added term gets smaller, the total grows without bound as n increases — just very slowly, roughly like the natural logarithm of n.

Stacked unit fractions summing to a harmonic number
A harmonic number is the sum of the unit fractions \(1, \frac{1}{2}, \frac{1}{3}, \ldots\) up to \(\frac{1}{n}\).

How to Use This Calculator

Enter a positive whole number \(n\) (the number of terms) and the calculator sums \(\frac{1}{k}\) from \(k = 1\) up to \(k = n\). The result is the exact decimal value of \(H(n)\). You can compare it to the approximation \(H(n) \approx \ln(n) + \gamma\), where \(\gamma \approx 0.5772\) is the Euler–Mascheroni constant; this estimate becomes very accurate for large n.

The Formula Explained

The defining formula is $$H(n) = \sum_{k=1}^{n} \frac{1}{k}.$$ There is no simple closed form, so the value is computed term by term. For example, $$H(4) = 1 + \frac{1}{2} + \frac{1}{3} + \frac{1}{4} = 1 + 0.5 + 0.333\ldots + 0.25 = 2.08333\ldots$$

Advertisement
Harmonic series area approximated by curve 1/x
The harmonic sum corresponds to the total area of unit-width rectangles under the curve \(y = \frac{1}{x}\).

Worked Example

For \(n = 5\): $$H(5) = 1 + \frac{1}{2} + \frac{1}{3} + \frac{1}{4} + \frac{1}{5} = 1 + 0.5 + 0.333333 + 0.25 + 0.2 = 2.283333.$$ The calculator returns this directly.

Advertisement

Interpreting H(n) and Its Growth

The harmonic number \(H(n) = 1 + \tfrac12 + \tfrac13 + \dots + \tfrac1n\) is the partial sum of the harmonic series. The series diverges, so H(n) increases without bound, but it does so very slowly, like the natural logarithm of n.

Asymptotic expansion

For large n,

$$H(n) \approx \ln(n) + \gamma + \frac{1}{2n} - \frac{1}{12n^2} + \cdots$$

Here \(\gamma \approx 0.5772157\) is the Euler–Mascheroni constant. Each extra term sharpens the estimate. For example, with n = 10:

$$\ln(10) + \gamma + \frac{1}{20} - \frac{1}{1200} \approx 2.302585 + 0.577216 + 0.05 - 0.000833 = 2.928967$$

The exact value is \(H(10) = 7381/2520 \approx\) 2.928968, so the four-term estimate is accurate to about six decimal places.

Error of the simple approximation

If you use only \(\ln(n) + \gamma\), the error is about \(\tfrac{1}{2n}\), because the next term in the expansion is \(+\tfrac{1}{2n}\). The approximation always underestimates H(n) slightly. At n = 100 the error is about 0.005, and at n = 1,000 it is about 0.0005.

Growth is exponential in the target value

Because \(H(n) \approx \ln(n) + \gamma\), reaching a target value T needs roughly \(n \approx e^{T-\gamma}\) terms. The number of terms therefore grows exponentially with T. For example, H(n) first exceeds 10 at n = 12,367, and exceeding 20 needs on the order of 272 million terms.

Integral bounds

Comparing the sum with the area under \(1/x\) gives, for every integer \(n \ge 2\):

$$\ln(n+1) < H(n) < 1 + \ln(n)$$

For n = 1, \(H(1) = 1\) equals the upper bound \(1 + \ln 1\), so the strict inequality holds only from n = 2 onward. For n = 10 the bounds give \(2.398 < 2.929 < 3.303\). These bounds show that H(n) grows without limit but only logarithmically.

Never an integer for n > 1

H(n) is an integer only for n = 1. For n > 1, let \(2^m\) be the largest power of 2 not exceeding n. It is the only term in the sum whose denominator contains \(2^m\), so the sum has an even denominator and cannot be a whole number. In lowest terms, H(n) is therefore always a fraction with a numerator and denominator that both grow quickly (for example, \(H(4) = 25/12\)).

How to read the result

  • A small n gives an exact fraction; a large n is best understood through the \(\ln(n) + \gamma\) estimate.
  • Doubling n adds about \(\ln 2 \approx 0.693\) to H(n).
  • Multiplying n by 10 adds about \(\ln 10 \approx 2.303\).

FAQ

Does the harmonic series converge? No. The infinite harmonic series diverges, so \(H(n)\) keeps growing as n grows, though extremely slowly.

What is H(1)? \(H(1) = 1\), since the sum has a single term, \(\frac{1}{1}\).

Why is it called "harmonic"? The name comes from music: the wavelengths of overtones of a vibrating string are \(1, \frac{1}{2}, \frac{1}{3}, \frac{1}{4}, \ldots\) of the fundamental wavelength.

Last updated:

Most popular in Math and Statistics

View all Math and Statistics calculators