Free Harmonic Number Calculator

Enter any positive number (integer ≤ 1,000,000 or non-integer ≤ 1,000)

Hn

Enter a positive number to calculate the harmonic number

The harmonic number calculator (also referred to as a harmonic series calculator or Hn calculator) provides a straightforward way to compute the nth partial sum of the harmonic series. Whether you need the exact fraction for an integer input or a decimal approximation for a non‑integer value, this free online tool delivers the result quickly. It is equally useful for finding the sum of the harmonic series up to a given term, thus serving as an nth partial sum calculator as well.

Definition of a Harmonic Number

For a natural number nn, the nn‑th harmonic number HnH_n is defined as the sum of the reciprocals of the first nn positive integers:

Hn=∑k=1n1k=1+12+13+⋯+1n.H_n = \sum_{k=1}^{n} \frac{1}{k} = 1 + \frac{1}{2} + \frac{1}{3} + \cdots + \frac{1}{n}.

These numbers increase very slowly; for instance, H1000≈7.485H_{1000} \approx 7.485. They are closely related to the natural logarithm via the approximation Hn≈ln⁡n+γH_n \approx \ln n + \gamma, where γ≈0.5772156649\gamma \approx 0.5772156649 is the Euler‑Mascheroni constant. The connection is made precise by the integral ln⁡n=∫1n1x dx\ln n = \int_{1}^{n} \frac{1}{x}\,dx, which also explains the logarithmic growth. A well‑known result is that HnH_n is never an integer for n>1n > 1.

Calculating Hₙ for Integer n

For an integer nn, HnH_n can be obtained manually by adding the reciprocals of 1,2,…,n1, 2, \dots, n. The table below shows the first few harmonic numbers in both fractional and decimal forms:

nnHnH_n (fraction)HnH_n (decimal)
111.00000
23/21.50000
311/61.83333
425/122.08333
5137/602.28333
8761/2802.71786

The calculator displays the rational form (reduced to lowest terms) alongside the decimal when nn is an integer. This makes it simple to verify results or use the exact fraction in further calculations.

Extension to Non‑Integer Values

Although the elementary definition applies only to natural numbers, the digamma function ψ(z)\psi(z) allows an analytic continuation of HnH_n to positive real (and complex) arguments. The key relation is:

Hn=ψ(n+1)+γ,H_n = \psi(n+1) + \gamma,

where ψ(z)=Γ′(z)/Γ(z)\psi(z) = \Gamma'(z)/\Gamma(z) and γ\gamma is the Euler‑Mascheroni constant. For a positive non‑integer nn, the digamma function can be evaluated efficiently using the series:

ψ(z+1)=−γ+∑k=1∞zk(k+z),\psi(z+1) = -\gamma + \sum_{k=1}^{\infty} \frac{z}{k(k+z)},

which converges for all zz with positive real part. The calculator automates this procedure, so the user never has to handle the digamma function directly. The result is returned as a decimal rounded to five decimal places.

Relation to the Infinite Harmonic Series

The infinite harmonic series ∑k=1∞1k\sum_{k=1}^{\infty} \frac{1}{k} diverges—its partial sums grow without bound. The harmonic number HnH_n is precisely the nn‑th partial sum of this series. Therefore, the harmonic series calculator can be used to determine the sum of the harmonic series for any finite number of terms, serving as a sum‑of‑harmonic‑series calculator.

Approximate Formula

For quick estimates, the Euler–Maclaurin expansion provides an excellent approximation:

Hn≈ln⁡n+γ+12n−112n2+1120n4−⋯ .H_n \approx \ln n + \gamma + \frac{1}{2n} - \frac{1}{12n^{2}} + \frac{1}{120n^{4}} - \cdots.

Even using only the first three terms yields an error smaller than 0.0010.001 for n≥10n \ge 10.

How to Use the Calculator

  1. Enter a positive number nn (integer or non‑integer) in the input field.
  2. The tool instantly computes the corresponding harmonic number HnH_n.
  3. For integer nn, the result is shown both as a simplified fraction and as a decimal with five‑digit precision.
  4. For non‑integer nn, only the decimal approximation is displayed.
  5. To ensure fast response, the maximum allowed integer nn is 10610^{6}; for non‑integer nn the limit is 10310^{3}. Values beyond these limits can be handled upon request.

This harmonic number calculator is designed to be intuitive and accessible, making it a reliable choice for anyone who needs to evaluate harmonic numbers or explore the properties of the harmonic series.

FAQ

1. What is the nth harmonic number and how is it defined?

The nth harmonic number, Hn, is defined as the sum of the reciprocals of the first n natural numbers: Hn = 1 + 1/2 + 1/3 + … + 1/n for any natural number n. For non‑integer n, it is defined analytically using the digamma function: Hn = ψ(n+1) + γ.

2. Does the harmonic series converge?

No, the harmonic series diverges. Its partial sums (the harmonic numbers) grow without bound as n increases, though the growth is very slow (approximately logarithmic).

3. How can I compute Hn for a non‑integer n?

Harmonic numbers can be extended to non‑integer arguments via the digamma function: Hn = ψ(n+1) + γ, where ψ is the digamma function and γ is the Euler‑Mascheroni constant. The harmonic number calculator performs this interpolation automatically and returns a decimal approximation.

4. What are the input limits of the harmonic number calculator?

The calculator accepts integer n up to 1,000,000 and non‑integer n up to 1,000. For integer inputs, results are shown as both a simplified fraction and a decimal rounded to five decimal places; for non‑integers, only the decimal form is provided.

How to Use

  1. Enter a positive number (n) in the input field - supports integers up to 1,000,000 and non-integers up to 1,000.
  2. The calculator instantly computes the nth harmonic number Hₙ using the digamma function for precise results.
  3. For small integer values, the fraction form and series expansion are displayed alongside the decimal result.