Omni Calculator logo
Last updated:

Harmonic Number Calculator

New

Table of contents

What is a harmonic number? Harmonic number equationHow do you calculate a harmonic number for integers?How do you find the harmonic number of a non-integer?Calculating harmonic series sums and harmonic numbersHow to use this harmonic number calculatorFAQs

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+12+13++1n=k=1n1k\small \begin{align*} H_n &= \frac{1}{1} + \frac{1}{2} + \frac{1}{3} + \dotsb + \frac{1}{n}\\[1em] &= \sum_{k=1}^n\frac{1}{k} \end{align*}

where:

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

As a consequence of Bernard's postulate, HnH_n 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=1n1xdx\ln n = \int_1^n \frac{1}{x}dx. 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 H5H_5, we must evaluate the sum:

H5=n=151n=11+12+13+14+15=137602.28333\small \begin{align*} H_5 &= \sum_{n=1}^5 \frac{1}{n} \\[1.5em] &= \frac{1}{1} +\frac{1}{2} + \frac{1}{3} + \frac{1}{4}+ \frac{1}{5} \\[1.5em] &= \frac{137}{60} \approx 2.28333 \end{align*}

Test your understanding of how to find a harmonic number: Calculate the 8th harmonic number H8H_8 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γ\small \psi(n) = H_{n-1} - \gamma

where:

  • ψ(n)\psi(n) is the digamma function; and
  • γ\gamma 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)=ddxln(Γ(x))=Γ(x)Γ(x)\small \psi(x) = \frac{d}{dx}\ln\left(\Gamma(x)\right) = \frac{\Gamma'(x)}{\Gamma(x)}

where:

  • ln(x)\ln(x) is the natural logarithmic function; and
  • Γ(x)\Gamma(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\Re(z)>0):

ψ(z)=k=0z1(k+1)(k+z)γ\small\psi(z) = \sum_{k=0}^{\infty}\frac{z-1}{(k+1)(k+z)}-\gamma

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

ψ(n)=k=0n1(k+1)(k+n)γ\small\psi(n) = \sum_{k=0}^{\infty}\frac{n-1}{(k+1)(k+n)} -\gamma

Combining this equation with the initial interpolation relation we've introduced (ψ(n)=Hn1γ\psi(n) = H_{n-1} - \gamma), we can deduce that

Hn1γ=k=0n1(k+1)(k+n)γHn1=k=0n1(k+1)(k+n)Hn=k=0n(k+1)(k+n+1)\small\begin{align*} H_{n-1} - \gamma &=\sum_{k=0}^{\infty}\frac{\footnotesize n-1}{\footnotesize (k+1)(k+n)} -\gamma\\[1.5em] H_{n-1} &= \sum_{k=0}^{\infty}\frac{\footnotesize n-1}{\footnotesize (k+1)(k+n)}\\[1.5em] \therefore H_n &= \sum_{k=0}^{\infty}\frac{\footnotesize n}{\footnotesize (k+1)(k+n+1)} \end{align*}

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=11n=11+12+13+14+\sum_{n=1}^\infty \frac{1}{n}= \frac{1}{1} + \frac{1}{2} + \frac{1}{3} + \frac{1}{4} + \dotsb

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 HnH_n and display it below.
    • For integer values of nn, if HnH_n has a determinable fraction form, this calculator will provide it alongside its decimal form.
    • For non-integer values of nn, we can only provide HnH_n 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 10610^6, beyond which the algorithm will cause a perceptible lag in most machines. For the same reason, a non-integer nn greater than 10310^3 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

What is the 8ᵗʰ harmonic number?

H₈ = 761/280 = 2.71786. To calculate the 8th harmonic number yourself, follow these instructions:

  1. 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.
  2. 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.
  3. 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.

Check out 10 similar sequences calculators 🔗
Arithmetic sequenceCollatz conjectureConvolution...7 more