Harmonic Number Calculator
Calculate n-th harmonic numbers (Hn), generalized harmonic numbers, exact fractions, decimal expansions, and asymptotic approximations.
What is a Harmonic Number?
In mathematics, the \(n\)-th harmonic number, denoted \(H_n\), is the sum of the reciprocals of the first \(n\) positive integers:
$$H_n = \sum_{k=1}^n \frac{1}{k} = 1 + \frac{1}{2} + \frac{1}{3} + \frac{1}{4} + \dots + \frac{1}{n}$$Harmonic numbers appear frequently across number theory, algorithm analysis (such as the average running time of Quicksort), combinatorics (the Coupon Collector's problem), statistical physics, and data structures.
First 10 Harmonic Numbers Table
| Index (\(n\)) | Exact Rational Fraction (\(H_n\)) | Decimal Value |
|---|---|---|
| 1 | 1 | 1.000000 |
| 2 | 3 / 2 | 1.500000 |
| 3 | 11 / 6 | 1.833333 |
| 4 | 25 / 12 | 2.083333 |
| 5 | 137 / 60 | 2.283333 |
| 6 | 49 / 20 | 2.450000 |
| 7 | 363 / 140 | 2.592857 |
| 8 | 761 / 280 | 2.717857 |
| 9 | 7129 / 2520 | 2.828968 |
| 10 | 7381 / 2520 | 2.928968 |
Asymptotic Expansion and Euler-Mascheroni Constant
As \(n\) grows large, computing the harmonic sum term by term becomes computationally demanding. Fortunately, Euler discovered that harmonic numbers grow logarithmically:
$$H_n = \ln(n) + \gamma + \frac{1}{2n} - \frac{1}{12n^2} + \frac{1}{120n^4} - \mathcal{O}\left(\frac{1}{n^6}\right)$$Here \(\gamma \approx 0.5772156649\) is the celebrated Euler-Mascheroni constant. Even for moderate values like \(n = 10\), this asymptotic series produces approximations accurate to several decimal places.
Generalized Harmonic Numbers
The generalized harmonic number of order \(m\), written \(H_{n,m}\) or \(H_n^{(m)}\), sums reciprocal powers:
$$H_{n,m} = \sum_{k=1}^n \frac{1}{k^m} = 1 + \frac{1}{2^m} + \frac{1}{3^m} + \dots + \frac{1}{n^m}$$When \(n \to \infty\), if \(m > 1\), the series converges to the famous Riemann zeta function \(\zeta(m)\). For instance, when \(m = 2\), the infinite sum equals \(\zeta(2) = \frac{\pi^2}{6} \approx 1.644934\) (the Basel problem).
Related Mathematical Sequence Tools
Explore other helpful sequence and number calculators:
- Harmonic Mean Calculator
- Arithmetic Sequence Generator
- Geometric Sequence Generator
- Fibonacci Numbers Calculator
Frequently Asked Questions
Does the harmonic series converge or diverge?
The harmonic series \(\sum_{k=1}^\infty \frac{1}{k}\) diverges to infinity, meaning as \(n \to \infty\), \(H_n \to \infty\). However, it diverges very slowly because \(H_n\) grows logarithmically like \(\ln(n)\).
Can a harmonic number \(H_n\) ever be an integer for \(n > 1\)?
No. In 1915, Taeisinger proved that \(H_n\) is never an integer for any integer \(n > 1\). The highest power of 2 dividing the denominators ensures that the reduced fractional form always has an even denominator.
What is the sum of the first \(n\) harmonic numbers?
The sum of the first \(n\) harmonic numbers has the closed-form formula \(\sum_{k=1}^n H_k = (n + 1) H_n - n\).
What is the alternating harmonic series?
The alternating harmonic series is \(\sum_{k=1}^\infty \frac{(-1)^{k-1}}{k} = 1 - \frac{1}{2} + \frac{1}{3} - \frac{1}{4} + \dots\). Unlike the standard harmonic series, the alternating series converges conditionally to \(\ln(2) \approx 0.693147\).