From: 3blue1brown

A surprising connection exists between the seemingly unrelated concepts of natural logarithms and prime numbers. This relationship becomes apparent when examining the density of primes and certain infinite series.

Estimating Prime Density

Consider the numbers between one trillion (10^12) and one trillion plus a thousand [00:00:21]. While performing a painstaking calculation would be difficult, a simple Python program can identify the primes within this range [00:00:55]. It’s observed that prime numbers get sparser as they increase in value [00:01:27].

For the range between 1 trillion and 1 trillion plus a thousand, there are 37 primes [00:03:53]. This means the proportion of primes in this range is 0.037, or approximately 1 in 27 [00:03:58], [00:04:09].

Mathematicians can estimate this proportion quickly because the density of prime numbers near a given value, like a trillion, is approximately the reciprocal of the natural logarithm of that number [00:04:15], [00:04:22].

The natural logarithm (ln) of a number ‘X’ answers the question “e to what power equals X?” [00:04:51]. For example, ln(10) is approximately 2.3, meaning e^2.3 ≈ 10 [00:05:04], [00:05:19].

Calculating the natural logarithm of one trillion (10^12) yields approximately 27 [00:05:29], [00:05:36]. This aligns remarkably well with the observed density of 1 in 27, highlighting a profound connection between natural logarithms and prime numbers [00:05:47], [00:05:59].

Natural Logarithms and Series Involving Primes

The appearance of natural logarithms is not limited to prime density. They also arise in surprising manipulations of infinite series that involve pi and primes.

Euler’s Basel Problem and a “Prime Game”

Euler famously solved the Basel problem, showing that the sum of the reciprocals of all natural numbers squared (1/1^2 + 1/2^2 + 1/3^2 + …) equals π^2/6 [00:06:34], [00:06:51], [00:06:59].

A peculiar “game” can be played with this series:

  • Exclude 1.
  • Keep terms corresponding to prime numbers as they are (e.g., 1/2^2, 1/3^2, 1/5^2, 1/7^2…).
  • For terms that are powers of primes (e.g., 4=2^2, 8=2^3, 9=3^2), keep the term but scale it down by the inverse of its exponent (e.g., 1/4^2 scaled by 1/2, 1/8^2 scaled by 1/3, 1/9^2 scaled by 1/2) [00:07:27], [00:08:18].
  • Exclude all other composite numbers (e.g., 6, 10, 12, 14, 15) [00:08:03], [00:08:33].

Despite its seemingly chaotic manipulation, this new series sums to the natural logarithm of the original result: ln(π^2/6) [00:09:19], [00:09:22].

Leibniz Formula for Pi and Primes

Another example is the Leibniz formula for π/4, an alternating series of the reciprocals of odd numbers: 1 - 1/3 + 1/5 - 1/7 + … = π/4 [00:09:55], [00:09:58], [00:10:03].

If the same “prime game” is applied to this series (excluding 1, keeping primes, scaling down prime powers, excluding other composites), the resulting sum is ln(π/4) [00:10:14], [00:11:06]. This suggests a deep and consistent relationship between natural logarithms and prime patterns [00:11:19].

Natural Logarithms and Series of Reciprocals

The natural logarithm also describes the behavior of harmonic series.

The Diverging Harmonic Series

The sum of the reciprocals of all natural numbers (1 + 1/2 + 1/3 + 1/4 + …) is known as the harmonic series [00:13:41]. Unlike the sum of squares, this series does not converge to a finite number; it diverges [00:13:46], [00:13:49]. This can be proven by grouping terms, showing that the sum can always exceed any chosen number [00:14:13], [00:15:50].

The sum of the harmonic series up to ‘n’ terms (S_n) is approximately equal to ln(n) [00:16:54], [00:16:58]. More precisely, S_n ≈ ln(n) + γ, where γ (gamma) is the Euler–Mascheroni constant (approximately 0.577) [01:02:10], [01:02:21]. This constant quantifies the difference between the harmonic sum and the natural logarithm [01:02:31].

The derivative of ln(x) is 1/x [00:53:59]. Conversely, the integral of 1/x from 1 to n is ln(n) [00:55:21], [01:01:32]. The harmonic series sum can be visualized as a sum of rectangles whose total area is slightly larger than the area under the curve of 1/x [00:58:13], [00:59:06].

The Alternating Harmonic Series

The alternating harmonic series (1 - 1/2 + 1/3 - 1/4 + …) converges to ln(2) [01:03:03], [01:03:05], [01:03:09].

This can be understood by generalizing the series into a function: f(x) = x/1 - x^2/2 + x^3/3 - x^4/4 + … [01:05:04]. Taking the derivative of this series simplifies it to a geometric series: f’(x) = 1 - x + x^2 - x^3 + … [01:05:35], [01:05:41].

A geometric series of the form 1 + r + r^2 + … sums to 1/(1-r) [01:06:44], [01:06:49]. In this case, r = -x, so f’(x) = 1/(1 - (-x)) = 1/(1 + x) [01:06:52], [01:08:11].

To find the sum of the original alternating series (which is f(1)), one can integrate f’(x) from 0 to 1 [01:08:17], [01:08:21]. The integral of 1/(1+x) is ln(1+x) [01:09:54]. Evaluating this from 0 to 1 gives ln(1+1) - ln(1+0) = ln(2) - ln(1) = ln(2) - 0 = ln(2) [01:10:23], [01:10:39], [01:10:47].

This sequence of manipulations demonstrates how natural logarithms emerge from seemingly unrelated series, further emphasizing their fundamental role in mathematics, particularly in relation to the behavior and distribution of prime numbers.