Try To Calculator logoTry To Calculator

Harmonic Number Calculator

Last updated: October 17, 202417 people find this calculator helpful
Loading calculator…

Our harmonic number calculator is the perfect solution for anyone seeking to find the nn-th harmonic number or to calculate the sum of the harmonic series of the first nn terms.

It is common to have misconceptions regarding the harmonic number and harmonic series. So we shall discuss some basic concepts on this subject. Specifically, let's answer these questions:

  • What is a harmonic number and its equation?
  • How do you calculate a harmonic number for integers and non-integers?
  • What is the formula for the sum of harmonic series?
  • What is the relation between harmonic number and harmonic series?

Whether you're a novice or an advanced reader, we hope that you'll learn something interesting here today. So grab your favorite snacks and explore this topic with us!

What is a harmonic number? Harmonic number equation

We define the nn-th harmonic number as the sum of the reciprocals of the first nn natural numbers:

Hn=11+21+31++n1=k=1nk1Hn=11+21+31++n1=k=1nk1

where:

  • HnHn is the nn-th harmonic number; and
  • nn is any natural number.

As a consequence of Bernard's postulate, HnHn is never an integer unless n=1n=1.

🔎 Notice that the harmonic numbers are a rough approximation of the natural logarithm, which is given by lnn=1nx1dxlnn=1nx1dx. To learn more about the natural logarithm, use our natural log calculator.

How do you calculate a harmonic number for integers?

To calculate the harmonic number Hₙ for any integer n, use the following steps:

  1. Divide 1 by the first n natural numbers and gather them in a sequence to get: 1/1, 1/2, 1/3, … 1/n.
  2. Add every number in this sequence to get the n-th harmonic number as Hn = 1 + 1/2 + 1/3 + … + 1/n.
  3. Verify your answer using our harmonic number calculator.

For example, to calculate the 5th harmonic number H5H5, we must evaluate the sum:

H5=n=15n1=11+21+31+41+51=601372.28333H5=n=15n1=11+21+31+41+51=601372.28333

Test your understanding of how to find a harmonic number: Calculate the 8th harmonic number H8H8 yourself using the harmonic number equation. You can verify your answer using our calculator or our FAQ section.

How do you find the harmonic number of a non-integer?

Strictly speaking, harmonic numbers are defined only for natural numbers. We can use them for various purposes, including finding the bessel function values. However, we can use the following expression to interpolate harmonic numbers for non-integers:

ψ(n)=Hn1γψ(n)=Hn1γ

where:

  • ψ(n)ψ(n) is the digamma function; and
  • γγ is the Euler–Mascheroni constant, which is roughly 0.5770.577.

Let's break this down, starting with the digamma function, which we define as the logarithmic derivative of the gamma function:

ψ(x)=dxdln(Γ(x))=Γ(x)Γ(x)ψ(x)=dxdln(Γ(x))=Γ(x)Γ(x)

where:

  • ln(x)ln(x) is the natural logarithmic function; and
  • Γ(x)Γ(x) is the gamma function.

Please don't panic — you won't need to evaluate these complicated functions to find our harmonic number. Still, it helps to learn more about this gamma function using our gamma function calculator.

There are many methods to evaluate this digamma function, but the simplest one we can use is the following expression, which is valid for any complex number zz whose real component is positive (i.e., (z)>0(z)>0):

ψ(z)=k=0(k+1)(k+z)z1γψ(z)=k=0(k+1)(k+z)z1γ

Re-writing this equation for z=n+0iz=n+0i, where nn is an arbitrary positive non-integer, we would get:

ψ(n)=k=0(k+1)(k+n)n1γψ(n)=k=0(k+1)(k+n)n1γ

Combining this equation with the initial interpolation relation we've introduced (ψ(n)=Hn1γψ(n)=Hn1γ), we can deduce that

Hn1γHn1Hn=k=0(k+1)(k+n)n1γ=k=0(k+1)(k+n)n1=k=0(k+1)(k+n+1)nHn1γHn1Hn=k=0(k+1)(k+n)n1γ=k=0(k+1)(k+n)n1=k=0(k+1)(k+n+1)n

And voila! An equation to evaluate harmonic numbers for any non-integer nn is at hand! And as we promised, you needn't calculate any extra functions to find the answer. Also, you need not sum this series to infinity — this series will converge after a finite number of iterations.

Now that you've learned how to calculate harmonic numbers, let's find out how they are related to calculating the sum of harmonic series.

Calculating harmonic series sums and harmonic numbers

The harmonic series is the sum of the reciprocals of all natural numbers, given by:

n=1n1=11+21+31+41+n=1n1=11+21+31+41+

While its definition is similar to that of a harmonic number, you can see from the formula for the sum of harmonic series it is an infinite series. The harmonic number is considered a partial sum of the harmonic series, where the series contains the reciprocals of the first nn natural numbers, instead of all natural numbers.

If you're interested in how harmonic series and music are related, we urge you to check out our harmonic series calculator.

How to use this harmonic number calculator

This harmonic number calculator is easy to use and is always here to help you. To calculate the harmonic number of a positive number nn, or to calculate the sum of harmonic series up to the nn-th term:

  1. Enter the positive number in the field labeled n.
  2. This calculator will evaluate the nn-th harmonic number HnHn and display it below.
    • For integer values of nn, if HnHn has a determinable fraction form, this calculator will provide it alongside its decimal form.
    • For non-integer values of nn, we can only provide HnHn in decimal form.

Note that we round all decimal answers to 5 decimal places. Also, to keep the computational time to a minimum, we've capped the maximum value of an integer nn at 106106, beyond which the algorithm will cause a perceptible lag in most machines. For the same reason, a non-integer nn greater than 103103 is not allowed.

Don't hesitate to contact us if you want to compute a harmonic number of any number larger than these limits.

FAQs

How do you calculate a harmonic number for integers?
To calculate the harmonic number Hₙ for any integer n, use the following steps: Divide 1 by the first n natural numbers and gather them in a sequence to get: 1/1, 1/2, 1/3, … 1/n. Add every number in this sequence to get the n-th harmonic number as Hn = 1 + 1/2 + 1/3 + … + 1/n. Verify your answer using our harmonic number calculator.
What is the 8ᵗʰ harmonic number?
H₈ = 761/280 = 2.71786. To calculate the 8th harmonic number yourself, follow these instructions: Divide 1 by the first 8 natural numbers and gather them in a sequence to get: 1/1, 1/2, 1/3, 1/4, 1/5, 1/6, 1/7, 1/8. Add every number in this sequence to get the n-th harmonic number as Hn = 1 + 1/2 + 1/3 + 1/4 + 1/5 + 1/6 + 1/7 + 1/8 = 761/280 = 2.71786. Verify your answer using our harmonic number calculator.
Is the harmonic series a p-series?
Yes. The harmonic series is a special case of p-series given by ∑ 1/nᵖ, where p = 1.
Does the harmonic series converge?
No, the harmonic series does not converge. The consecutive numbers in the series do not get small fast enough to enable a convergence.

Related calculators