Skip to main content

Harmonic Number Calculator

Calculate harmonic number instantly with our math tool. Shows detailed work, formulas used, and multiple solution methods.

Skip to calculator
Mathematics

Harmonic Number Calculator

Calculate harmonic numbers, generalized harmonic numbers, and related quantities. Explore partial sums, Euler-Mascheroni constant approximations, and convergence analysis.

Last updated: December 2025Reviewed by NovaCalculator Mathematics Team

Calculator

Adjust values & calculate
10
1
H_10^(1)
2.928968254
ln(10)
2.302585093
H_n - ln(n)
0.626383161
Euler-Mascheroni
0.577216
Harmonic Mean
3.4141715215
Alternating Sum
0.6456349206
Asymptotic Approx
2.9289674246
Approx Error
8.294e-7

Partial Sums Table

n = 11/1^1 = 1H = 1
n = 21/2^1 = 0.5H = 1.5
n = 31/3^1 = 0.3333333333H = 1.8333333333
n = 41/4^1 = 0.25H = 2.0833333333
n = 51/5^1 = 0.2H = 2.2833333333
n = 61/6^1 = 0.1666666667H = 2.45
n = 71/7^1 = 0.1428571429H = 2.5928571429
n = 81/8^1 = 0.125H = 2.7178571429
n = 91/9^1 = 0.1111111111H = 2.828968254
n = 101/10^1 = 0.1H = 2.928968254
Your Result
H_10^(1) = 2.928968254 | ln(10) = 2.302585093 | Harmonic Mean = 3.4141715215
Share Your Result
Understand the Math

Formula

H_n = 1 + 1/2 + 1/3 + ... + 1/n

The nth harmonic number is the sum of reciprocals of the first n positive integers. The generalized form H_n^(s) sums 1/k^s for k=1 to n. For large n, H_n is approximately ln(n) + gamma where gamma = 0.5772... is the Euler-Mascheroni constant.

Last reviewed: December 2025

Worked Examples

Example 1: Computing the 10th Harmonic Number

Calculate H_10 = 1 + 1/2 + 1/3 + ... + 1/10.
Solution:
H_10 = 1 + 0.5 + 0.3333 + 0.25 + 0.2 + 0.1667 + 0.1429 + 0.125 + 0.1111 + 0.1 H_10 = 2.928968... Approximation: ln(10) + gamma = 2.3026 + 0.5772 = 2.8798 Difference: H_10 - ln(10) = 0.6263 (approaching gamma = 0.5772) Harmonic mean of 1-10: 10/H_10 = 3.414
Result: H_10 = 2.928968 | Approximation = 2.8798 | Harmonic mean = 3.414

Example 2: Generalized Harmonic Number (s=2)

Calculate H_10^(2) = 1 + 1/4 + 1/9 + ... + 1/100 (sum of reciprocal squares).
Solution:
H_10^(2) = 1 + 0.25 + 0.1111 + 0.0625 + 0.04 + 0.02778 + 0.02041 + 0.015625 + 0.01235 + 0.01 H_10^(2) = 1.54977 The infinite sum converges to zeta(2) = pi^2/6 = 1.64493 H_10^(2) captures 94.2% of the infinite sum Remaining sum approximately 1/(s-1) * 1/n^(s-1) = 0.1
Result: H_10^(2) = 1.54977 | zeta(2) = 1.64493 | Coverage = 94.2%
Expert Insights

Background & Theory

The Harmonic Number Calculator applies the following established principles and formulas. Mathematics rests on a hierarchy of number systems, each extending the previous. The natural numbers (1, 2, 3, ...) support counting and ordering. The integers add negative values and zero, enabling subtraction without restriction. The rational numbers, expressible as p/q where p and q are integers and q is nonzero, close the system under division. The real numbers fill the gaps left by irrationals such as the square root of 2 or pi, forming a complete ordered field. The complex numbers, written as a + bi where i is the square root of negative one, complete the algebraic closure of the reals and allow every polynomial to have a root. Prime factorization states that every integer greater than one is uniquely expressible as a product of primes, a result known as the Fundamental Theorem of Arithmetic. Computing the greatest common divisor (GCD) of two integers relies most efficiently on the Euclidean algorithm: repeatedly replace the larger number with the remainder when it is divided by the smaller, until the remainder is zero. The last nonzero remainder is the GCD. The least common multiple (LCM) follows from the identity LCM(a, b) = |a * b| / GCD(a, b). Modular arithmetic defines equivalence classes of integers that share the same remainder under division by a modulus n. Fermat's Little Theorem and Euler's Theorem arise from this structure and underpin modern cryptography. Logarithms are the inverses of exponential functions. If b raised to the power x equals y, then the logarithm base b of y equals x. The natural logarithm uses base e, approximately 2.71828. Combinatorics counts arrangements and selections. The number of ordered arrangements (permutations) of r objects from n distinct objects is nPr = n! / (n - r)!. The number of unordered selections (combinations) is nCr = n! / (r! * (n - r)!). Pascal's triangle arranges these binomial coefficients so that each entry equals the sum of the two entries directly above it. The Fibonacci sequence, defined by F(1) = 1, F(2) = 1, and F(n) = F(n-1) + F(n-2), appears throughout nature and connects deeply to the golden ratio via Binet's formula.

History

The history behind the Harmonic Number Calculator traces back through the following developments. Mathematics as a systematic discipline traces to ancient Mesopotamia. Babylonian clay tablets dating to around 1800 BCE demonstrate knowledge of quadratic equations, Pythagorean triples, and base-60 arithmetic, suggesting a practical mathematical tradition far preceding Greek formalism. Euclid of Alexandria compiled the Elements around 300 BCE, establishing the axiomatic method that would define rigorous mathematics for over two thousand years. His work organized plane geometry, number theory, and proportion into logically chained propositions derived from a small set of postulates. The algorithm bearing his name for computing GCDs appears in Book VII and remains in use today. In the 9th century, the Persian scholar Muhammad ibn Musa Al-Khwarizmi wrote Al-Kitab al-mukhtasar fi hisab al-jabr wal-muqabala, the treatise whose title gave algebra its name. He systematized the solution of linear and quadratic equations and described procedures that operated on unknowns as objects, a conceptual leap away from purely numerical calculation. Rene Descartes introduced coordinate geometry in 1637 by uniting algebra and Euclidean geometry, allowing curves to be studied through equations. This synthesis set the stage for calculus. Isaac Newton and Gottfried Wilhelm Leibniz independently developed calculus during the 1660s and 1670s, triggering a priority dispute that lasted decades and divided British and Continental mathematicians. Carl Friedrich Gauss proved the Fundamental Theorem of Algebra in 1799, showing that every nonconstant polynomial has at least one complex root. His Disquisitiones Arithmeticae of 1801 established modern number theory. David Hilbert's formalist program at the turn of the 20th century sought to place all of mathematics on an explicit axiomatic foundation, a project that Kurt Godel's incompleteness theorems of 1931 showed to be fundamentally limited. Alan Turing's work in the 1930s on computability introduced the theoretical model of the stored-program computer and linked mathematical logic directly to the limits of algorithmic calculation. His proof that no algorithm can decide in general whether an arbitrary program will halt or run forever placed fundamental boundaries on what mathematics can mechanically determine, and it opened the discipline now known as theoretical computer science.

Share this calculator

Explore More

Frequently Asked Questions

The nth harmonic number H_n is the sum of the reciprocals of the first n positive integers: H_n = 1 + 1/2 + 1/3 + 1/4 + ... + 1/n. For example, H_4 = 1 + 0.5 + 0.333... + 0.25 = 2.0833... The harmonic numbers grow without bound (they diverge), but they grow very slowly compared to n itself. The growth rate is approximately ln(n) + gamma, where gamma is the Euler-Mascheroni constant (approximately 0.5772). Harmonic numbers appear frequently in combinatorics, number theory, analysis of algorithms, and probability. They are named after the harmonic series in music, where overtone frequencies are integer multiples of a fundamental frequency.
The harmonic series (the sum of 1/n from n=1 to infinity) diverges, meaning it grows without bound. This is remarkable because the individual terms 1/n approach zero, yet their sum still grows to infinity. The classic proof groups terms in powers of 2: (1) + (1/2) + (1/3 + 1/4) + (1/5 + 1/6 + 1/7 + 1/8) + ... Each group sums to at least 1/2, so the total exceeds any finite number. However, the divergence is extremely slow. To reach a sum of 10, you need about 12,367 terms. To reach 20, you need about 272 million terms. To reach 100, you would need approximately 10^43 terms. This slow divergence makes the harmonic series a borderline case in convergence analysis.
Generalized harmonic numbers H_n^(s) extend the standard harmonic number by raising each denominator to a power s: H_n^(s) = 1 + 1/2^s + 1/3^s + ... + 1/n^s. When s = 1, this gives the standard harmonic numbers. When s = 2, we get the sum of reciprocal squares, which converges to pi^2/6 (the Basel problem solved by Euler). For any s > 1, the infinite sum converges to the Riemann zeta function zeta(s). For s <= 1, the series diverges. The case s = 0 gives H_n^(0) = n. Generalized harmonic numbers are useful in analytic number theory, statistical mechanics, and the analysis of random algorithms where different powers of reciprocals arise naturally.
Harmonic numbers appear frequently in the analysis of computer algorithms. The expected number of comparisons in quicksort is approximately 2n * H_n, which gives the famous O(n log n) average case. The coupon collector problem asks how many random draws are needed to collect all n distinct items: the expected number is n * H_n. In hash table analysis, the expected maximum chain length involves harmonic numbers. Skip lists have search times related to harmonic sums. The average number of steps in the Euclidean algorithm for computing GCD relates to harmonic numbers. Understanding harmonic growth (roughly logarithmic) is essential for predicting algorithm performance in practice.
Harmonic numbers are closely approximated by the natural logarithm: H_n is approximately equal to ln(n) + gamma, where gamma is the Euler-Mascheroni constant. This relationship arises because the harmonic sum H_n = sum(1/k, k=1..n) approximates the integral of 1/x from 1 to n, which equals ln(n). The difference H_n - ln(n) converges to gamma as n grows. More precise asymptotic expansions give H_n approximately equal to ln(n) + gamma + 1/(2n) - 1/(12n^2) + 1/(120n^4) - ... This relationship connects discrete sums with continuous integrals and is an example of the Euler-Maclaurin formula, a powerful tool for approximating sums by integrals.
The alternating harmonic series is 1 - 1/2 + 1/3 - 1/4 + 1/5 - ... = sum((-1)^(n+1)/n, n=1..infinity). Unlike the standard harmonic series, this alternating version converges, and its sum is exactly ln(2) = 0.693147... This can be proven using Taylor series: ln(1+x) = x - x^2/2 + x^3/3 - x^4/4 + ..., and substituting x = 1 gives ln(2). The alternating series converges conditionally but not absolutely (since the absolute values form the divergent harmonic series). By the Riemann rearrangement theorem, rearranging the terms can make the series converge to any desired value, which demonstrates the importance of distinguishing absolute from conditional convergence.
Educational Note: This calculator is provided for educational and informational purposes. Results are based on the formulas and inputs provided. Always verify important calculations independently. NovaCalculator processes calculator inputs client-side; optional analytics follow visitor consent settings.Reviewed by: NovaCalculator Mathematics Team โ€” Verified against standard mathematical and scientific references. Last reviewed: December 2025. ยฉ 2024โ€“2026 NovaCalculator.

Share this calculator

Formula

H_n = 1 + 1/2 + 1/3 + ... + 1/n

The nth harmonic number is the sum of reciprocals of the first n positive integers. The generalized form H_n^(s) sums 1/k^s for k=1 to n. For large n, H_n is approximately ln(n) + gamma where gamma = 0.5772... is the Euler-Mascheroni constant.

Worked Examples

Example 1: Computing the 10th Harmonic Number

Problem: Calculate H_10 = 1 + 1/2 + 1/3 + ... + 1/10.

Solution: H_10 = 1 + 0.5 + 0.3333 + 0.25 + 0.2 + 0.1667 + 0.1429 + 0.125 + 0.1111 + 0.1\nH_10 = 2.928968...\nApproximation: ln(10) + gamma = 2.3026 + 0.5772 = 2.8798\nDifference: H_10 - ln(10) = 0.6263 (approaching gamma = 0.5772)\nHarmonic mean of 1-10: 10/H_10 = 3.414

Result: H_10 = 2.928968 | Approximation = 2.8798 | Harmonic mean = 3.414

Example 2: Generalized Harmonic Number (s=2)

Problem: Calculate H_10^(2) = 1 + 1/4 + 1/9 + ... + 1/100 (sum of reciprocal squares).

Solution: H_10^(2) = 1 + 0.25 + 0.1111 + 0.0625 + 0.04 + 0.02778 + 0.02041 + 0.015625 + 0.01235 + 0.01\nH_10^(2) = 1.54977\nThe infinite sum converges to zeta(2) = pi^2/6 = 1.64493\nH_10^(2) captures 94.2% of the infinite sum\nRemaining sum approximately 1/(s-1) * 1/n^(s-1) = 0.1

Result: H_10^(2) = 1.54977 | zeta(2) = 1.64493 | Coverage = 94.2%

Frequently Asked Questions

What is a harmonic number and how is it calculated?

The nth harmonic number H_n is the sum of the reciprocals of the first n positive integers: H_n = 1 + 1/2 + 1/3 + 1/4 + ... + 1/n. For example, H_4 = 1 + 0.5 + 0.333... + 0.25 = 2.0833... The harmonic numbers grow without bound (they diverge), but they grow very slowly compared to n itself. The growth rate is approximately ln(n) + gamma, where gamma is the Euler-Mascheroni constant (approximately 0.5772). Harmonic numbers appear frequently in combinatorics, number theory, analysis of algorithms, and probability. They are named after the harmonic series in music, where overtone frequencies are integer multiples of a fundamental frequency.

Does the harmonic series converge or diverge?

The harmonic series (the sum of 1/n from n=1 to infinity) diverges, meaning it grows without bound. This is remarkable because the individual terms 1/n approach zero, yet their sum still grows to infinity. The classic proof groups terms in powers of 2: (1) + (1/2) + (1/3 + 1/4) + (1/5 + 1/6 + 1/7 + 1/8) + ... Each group sums to at least 1/2, so the total exceeds any finite number. However, the divergence is extremely slow. To reach a sum of 10, you need about 12,367 terms. To reach 20, you need about 272 million terms. To reach 100, you would need approximately 10^43 terms. This slow divergence makes the harmonic series a borderline case in convergence analysis.

What are generalized harmonic numbers?

Generalized harmonic numbers H_n^(s) extend the standard harmonic number by raising each denominator to a power s: H_n^(s) = 1 + 1/2^s + 1/3^s + ... + 1/n^s. When s = 1, this gives the standard harmonic numbers. When s = 2, we get the sum of reciprocal squares, which converges to pi^2/6 (the Basel problem solved by Euler). For any s > 1, the infinite sum converges to the Riemann zeta function zeta(s). For s <= 1, the series diverges. The case s = 0 gives H_n^(0) = n. Generalized harmonic numbers are useful in analytic number theory, statistical mechanics, and the analysis of random algorithms where different powers of reciprocals arise naturally.

How are harmonic numbers used in algorithm analysis?

Harmonic numbers appear frequently in the analysis of computer algorithms. The expected number of comparisons in quicksort is approximately 2n * H_n, which gives the famous O(n log n) average case. The coupon collector problem asks how many random draws are needed to collect all n distinct items: the expected number is n * H_n. In hash table analysis, the expected maximum chain length involves harmonic numbers. Skip lists have search times related to harmonic sums. The average number of steps in the Euclidean algorithm for computing GCD relates to harmonic numbers. Understanding harmonic growth (roughly logarithmic) is essential for predicting algorithm performance in practice.

What is the relationship between harmonic numbers and the natural logarithm?

Harmonic numbers are closely approximated by the natural logarithm: H_n is approximately equal to ln(n) + gamma, where gamma is the Euler-Mascheroni constant. This relationship arises because the harmonic sum H_n = sum(1/k, k=1..n) approximates the integral of 1/x from 1 to n, which equals ln(n). The difference H_n - ln(n) converges to gamma as n grows. More precise asymptotic expansions give H_n approximately equal to ln(n) + gamma + 1/(2n) - 1/(12n^2) + 1/(120n^4) - ... This relationship connects discrete sums with continuous integrals and is an example of the Euler-Maclaurin formula, a powerful tool for approximating sums by integrals.

What is the alternating harmonic series and what does it sum to?

The alternating harmonic series is 1 - 1/2 + 1/3 - 1/4 + 1/5 - ... = sum((-1)^(n+1)/n, n=1..infinity). Unlike the standard harmonic series, this alternating version converges, and its sum is exactly ln(2) = 0.693147... This can be proven using Taylor series: ln(1+x) = x - x^2/2 + x^3/3 - x^4/4 + ..., and substituting x = 1 gives ln(2). The alternating series converges conditionally but not absolutely (since the absolute values form the divergent harmonic series). By the Riemann rearrangement theorem, rearranging the terms can make the series converge to any desired value, which demonstrates the importance of distinguishing absolute from conditional convergence.

References

Reviewed by Manoj Kumar, Mathematics Educator ยท Editorial policy