# Harmonic Number

The harmonic numbers are the partial sums of the harmonic series. The $n^\text{th}$ harmonic number is the sum of the reciprocals of each positive integer up to $n$. The first few harmonic numbers are as follows:

$\begin{aligned} H_1 &= 1 \\ \\ H_2 &= H_1+\frac{1}{2} = \frac{3}{2} \\ \\ H_3 &= H_2+\frac{1}{3} = \frac{11}{6} \\ \\ H_4 &= H_3+\frac{1}{4} = \frac{25}{12} \\ \\ H_5 &= H_4+\frac{1}{5} = \frac{137}{60} \\ \\ &\vdots \end{aligned}$

Harmonic numbers appear in many expressions involving special functions in analytic number theory, including the Riemann zeta function. They are also related closely to the natural logarithm.

## Definition

The $n^\text{th}$ harmonic number $H_n$ is the sum of the reciprocals of the first $n$ positive integers:

$H_n=\sum_{k=1}^{n} \dfrac{1}{k} = \dfrac{1}{1} + \dfrac{1}{2} + \dfrac{1}{3} + \dfrac{1}{4} + \dots + \dfrac{1}{n}.$

It can also be expressed with the recurrence relation

$H_n=H_{n-1}+\frac{1}{n}.$

## Properties

Note that $H_n$ is a (left) Riemann sum for the integral $\int_1^{n+1} \frac1{x} \, dx =\ln(n+1).$ So $H_n$ is roughly equal to $\ln(n).$ In fact, the difference between $H_n$ and $\ln(n)$ tends to a constant called the Euler-Mascheroni constant.

$H_n$ is a rational number. However,

There does not exist an integer $n>1$ such that $H_n$ is an integer.

Write $H_n = \frac{a_n}{n!}.$ Then $a_n$ is a sum of all the products of $n-1$ distinct integers between $1$ and $n$ inclusive. By Bertrand's postulate, there is a prime $p$ in the interval $\big(\frac{n}2,n\big]$ for $n \ge 2.$ Then $p$ divides exactly one of the integers between $1$ and $n$ inclusive, namely $p$ itself $($because $2p >n).$ So $a_n$ is a sum of all the products containing $p$ plus one that does not, which is not divisible by $p.$ So $p \not\mid a_n,$ but $p|n!,$ so $H_n$ cannot be an integer because its denominator, when it is reduced to lowest terms, will contain a factor of $p.$ $_\square$

The proof predicts that $H_6$ will contain a factor of $5$ in its denominator; indeed,

$H_6 = \frac{720+360+240+180+144+120}{720}$

and it is clear that the denominator is divisible by $5$ but the numerator is not.

It is somewhat surprising that harmonic numbers have no upper bound. That is, for any real number $x$, there exists a harmonic number that is greater than $x.$

The harmonic series diverges.

Suppose that the harmonic series converges, and consider the following series:

${\large\sum\limits_{k=1}^\infty{2^{-\left\lceil\log_2{k}\right\rceil}}}=1+\frac{1}{2}+\frac{1}{4}+\frac{1}{4}+\frac{1}{8}+\frac{1}{8}+\frac{1}{8}+\frac{1}{8}+\cdots,$

where the $\lceil \ \rceil$ grouping symbols denote the ceiling function.

Each term in this sequence is positive and less than or equal to the corresponding term in the harmonic series:

$\text{For any positive integer }k, \ 0<2^{-\left\lceil\log_2{k}\right\rceil} \le \frac{1}{k}.$

Then if the harmonic series converges, this series converges as well.

However, this series does not converge. Grouping the like terms gives a repeated sum of $\frac{1}{2}:$

${\large\sum\limits_{k=1}^\infty{2^{-\left\lceil\log_2{k}\right\rceil}}}=1+\frac{1}{2}+\underbrace{\frac{1}{4}+\frac{1}{4}}_{\frac{1}{2}}+\underbrace{\frac{1}{8}+\frac{1}{8}+\frac{1}{8}+\frac{1}{8}}_{\frac{1}{2}}+\cdots.$

The fact that this series diverges is a contradiction. Therefore, the harmonic series diverges. $_\square$

The harmonic numbers appear in expressions for integer values of the digamma function:

$\psi(n) = H_{n-1} - \gamma.$

The harmonic numbers are used in the definition of the Euler-Mascheroni constant $\gamma:$

$\gamma = \lim_{n \to \infty}{\big(H_n - \ln(n)\big)}.$

The harmonic numbers are used in an elementary reformulation (due to Lagarias) of the Riemann hypothesis.

The Riemann hypothesis is equivalent to the statement

$\sigma(n) \le H_n + \ln(H_n)e^{H_n}$

for all integers $n \ge 1,$ with strict inequality if $n>1,$ where $\sigma(n)$ denotes the sum of the positive divisors of $n.$

## Integral Representation

An integral representation for $H_n$ given by Euler is

$H_n = \int_0^1 \frac{1 - x^n}{1 - x}\,dx.$

$\big($This is clear since $\frac{1-x^n}{1-x} = 1+x+x^2+\cdots+x^{n-1}.\big)$

This can be used to find an alternating series representation of $H_n$ using the substitution $x = 1-u:$

$\begin{aligned} H_n &= \int_0^1 \frac{1 - x^n}{1 - x}\,dx \\ &=-\int_1^0\frac{1-(1-u)^n}{u}\,du \\ &= \int_0^1\frac{1-(1-u)^n}{u}\,du \\ &= \int_0^1\left[\sum_{k=1}^n(-1)^{k-1}\binom nk u^{k-1}\right]\,du \\ &= \sum_{k=1}^n (-1)^{k-1}\binom nk \int_0^1u^{k-1}\,du \\ &= \sum_{k=1}^n(-1)^{k-1}\frac{1}{k}\binom nk . \end{aligned}$

## Generating Function

The generating function for the harmonic numbers has a relatively simple closed form

$\sum_{n=1}^\infty H_nx^n = \frac{-\ln(1-x)}{1-x}$

for $-1\leq x<1.$

We have

$\begin{aligned} \sum_{n=1}^\infty H_nx^n &= \sum_{n=1}^\infty \sum_{k=1}^n \frac1{k} x^n \\ &= \sum_{k=1}^\infty \frac1{k} \big(x^k+x^{k+1}+\cdots\big) \\ &= \sum_{k=1}^\infty \frac1{k} \frac{x^k}{1-x} \\ &= \frac1{1-x} \sum_{k=1}^\infty \frac{x^k}{k} \\ &= \frac{-\ln(1-x)}{1-x}, \end{aligned}$

using the Maclaurin series for $\ln(1-x).$ $_\square$