Prime Numbers Near a Trillion
Natural Logarithms, Prime Numbers, and Exponential Growth
Prime density at large numbers
Prime numbers become less frequent as numbers grow. A number has more possible factors to test when it is large, so checking whether a large number is prime takes more work. For example, trial division only needs to test possible factors up to approximately the square root of the number.
A useful estimate for the density of primes near a large number x is
where lnx is the natural logarithm of x. This is a local estimate: among numbers near x, roughly one in every lnx is prime.
For numbers near one trillion, x=1012, and
Thus, near one trillion, the estimate is roughly one prime in every 28 numbers. In a range of 1,000 consecutive integers, this predicts about
primes. In the range from one trillion through one trillion plus 1,000, there are 37 primes, so the observed proportion is
or about one prime in every 27 numbers. This is close to the logarithmic estimate.
The Prime Number Theorem gives a related large-scale approximation: the number of primes up to x is approximately x/lnx. The local density estimate 1/lnx captures the corresponding idea that primes thin out gradually, rather than disappearing rapidly.
Near a large number x, the proportion of integers that are prime is approximately 1/lnx.
Natural logarithms
The natural logarithm is the logarithm with base e. The statement
means exactly that
In other words, lnx asks: “To what power must e be raised to obtain x?”
For example,
because e2.3 is approximately 10. This value is useful for converting between powers of e and powers of 10.
The natural logarithm appears in the estimate for prime density: near x=1012, the reciprocal logarithm 1/lnx predicts how frequently primes occur. Its appearance is one instance of a broader mathematical pattern: logarithms and primes are connected through series and products built from prime numbers.
Infinite series connected to π and primes
An infinite series is a sum of a sequence of terms. Some series approach a finite value as more terms are added; others grow without bound.
The sum of reciprocal squares
The series
converges to the value
This result, known as the Basel problem, is surprising because it connects the familiar constant π with the sum of reciprocals of integer squares.
Filtering the series to keep prime powers
The sum of reciprocal squares can be rearranged using prime factorization. Every integer greater than 1 is built from primes, and the resulting identity is
so that
This double sum includes terms associated with prime powers. A prime p contributes its own term, and each power pk contributes a term scaled by 1/k. For instance, the prime power 4=22 contributes with a factor of 1/2, and 8=23 contributes with a factor of 1/3. Numbers with multiple different prime factors, such as 6, do not appear as individual prime powers in this sum.
The logarithm arises from the relationship between sums and products. The Euler product for the reciprocal-square series is
Taking the logarithm of a product turns it into a sum. Expanding each factor then produces the terms involving prime powers.
An alternating series involving primes
Another series connected to π is the alternating sum over odd integers:
This is the alternating odd-reciprocal series. If its terms are reorganized using odd prime numbers and their powers, the corresponding prime-based sum gives
The prime-power terms carry signs determined by the alternating pattern, and prime powers are scaled according to their exponent. The relationship is another example of a logarithm turning a product involving primes into a sum over primes and their powers.
These identities show why prime numbers, prime powers, logarithms, and π often appear together: prime factorizations organize infinite products, and logarithms convert those products into sums.
Two important series involving reciprocals
The alternating harmonic series
The series
converges to
Since ln2≈0.693, the partial sums approach a value just under 0.7. Although the terms become smaller and the sum settles to a finite value, it does so slowly.
This series is part of a more general family:
for −1<x≤1. Substituting x=1 gives the alternating harmonic series and the value ln2.
The harmonic series
In contrast, the nonalternating harmonic series
does not converge. Its terms get smaller, but their sum grows without bound. It eventually exceeds any fixed target, such as 100 or a million.
A useful way to understand this divergence is to group terms in ranges whose sizes double:
In each group, every term is at least as large as the reciprocal of the group’s largest denominator.
The group containing 1/3 and 1/4 has two terms, each at least 1/4, so its sum is at least 2(1/4)=1/2.
The group from 1/5 through 1/8 has four terms, each at least 1/8, so its sum is at least 4(1/8)=1/2.
The group from 1/9 through 1/16 has eight terms, each at least 1/16, so its sum is at least 8(1/16)=1/2.
Every such group contributes at least 1/2. Since there are infinitely many groups, the total sum cannot remain bounded.
The harmonic sum grows logarithmically
Although the harmonic series diverges, it grows very slowly. The partial sum through 1/n is approximately
A more accurate approximation includes a constant:
where γ is the Euler–Mascheroni constant, approximately 0.577. Equivalently, the difference between the harmonic sum and lnn approaches γ as n becomes large.
This logarithmic growth explains why an enormous number of terms is needed for the harmonic sum to reach a large target. If the sum is to exceed approximately one million, the estimate Hn≈lnn suggests
and therefore
Expressed as a power of 10,
A rough estimate using ln(10)≈2 gives a value near 10500,000; using the more accurate value ln(10)≈2.3 gives an exponent near 434,000. Either way, the required n is vastly larger than the estimated number of atoms in the universe, around 1080.
Why calculus explains the harmonic-series estimates
The natural logarithm has a particularly useful derivative:
Consequently, the area under the curve y=1/x from 1 to n is
The harmonic sum and this integral are closely related. Each term 1/k can be pictured as the area of a rectangle of width 1 and height 1/k. The rectangles approximate the area under 1/x. With the standard placement of these rectangles, their total area is greater than the integral, because some rectangle area lies above the curve.
Thus,
The gap between the two quantities approaches the Euler–Mascheroni constant. This comparison connects a sum of discrete terms with the continuous area described by an integral.
Why exponentials are usually written using e
Different bases describe the same exponential families
A family of exponential functions can be written in several equivalent ways. For example,
The base a can be expressed using e because elna=a. Thus, varying a in ax is equivalent to varying the coefficient of x in erx.
There is nothing inherently special about writing an exponential with base e if the only goal is to describe its shape. The same family of curves could be written with another positive base, such as π. The advantage of using e becomes clear when studying rates of change.
The derivative of an exponential
The exponential function with base e satisfies
It is the function whose rate of change at each point is equal to its current value. More generally, by the chain rule,
The value r is the proportionality constant between the function’s current size and its rate of change. For example, if ert represents an investment’s value over time, its instantaneous rate of growth is r times its current value.
For an exponential with a different base,
Writing the function as etlna makes the rate-of-change constant explicit. This is why e is the standard choice in calculus, physics, and engineering: it keeps the relationship between a changing quantity and its rate of change especially simple.
The exponential function as a power series
The exponential function can be represented by the infinite series
Here, n! is the factorial of n. The notation exp(x) emphasizes that the function can be defined by this series, including when x is complex.
Term-by-term differentiation shows why the exponential is its own derivative:
Each power comes down as a multiplier, canceling one factor in the factorial denominator. Differentiation therefore reproduces the same series.
The function also has the addition property
If e is defined as exp(1), this property leads to the usual exponential notation exp(x)=ex. Thus, ex can be viewed either as an exponential function or as shorthand for the power series.
A different route to the same function is to define e through the derivative property: it is the base for which the derivative of ex equals ex. Either viewpoint highlights the same central relationship between exponentials and rates of change.
Exponentials in probability and statistics
A bell-shaped curve can be built from an exponential involving a negative square, such as
As x becomes large in either the positive or negative direction, x2 becomes large, so −x2 becomes strongly negative and the exponential approaches zero. The curve therefore decays on both sides of its center.
Using ∣x∣ instead would also make an expression decay in both directions, but it would create a sharp cusp at x=0. The square produces a smooth bell shape.
A normal distribution uses a shifted and rescaled version of this form. Its parameters control the location and width of the distribution: the mean determines its center, and the standard deviation determines its spread. The particular constants in the exponent are chosen so that these parameters have their standard statistical meanings.
The shape is not unique to the base e: powers of another suitable base can describe the same family of bell curves after adjusting the parameters. Again, e is especially convenient because it simplifies calculus and makes the parameters easier to work with.
Complex exponentials and rotation
Complex exponentials describe oscillation and rotation. The expression
moves around the unit circle in the complex plane as t changes. It can be written as
As t increases, the point travels around the circle, with t measuring the angle in radians. This relationship makes complex exponentials useful for describing sine waves, cosine waves, and oscillating signals in fields such as electrical engineering.
However, the rotational behavior is not exclusive to base e. Since
a complex exponential with another base also rotates around the unit circle; it simply changes the rate at which the angle advances.
The special convenience of eit can be understood through differentiation:
Multiplication by i rotates a complex vector by 90∘. Thus, the rate of change of the position vector is always perpendicular to the vector itself. Because the vector has length 1, the velocity also has length 1, giving motion around the unit circle at a constant rate. For a different base, the factor lna changes that rate.
Directly deriving the derivative of an exponential
The rate of change of ax can be derived using the definition of the derivative. A small change h in the input gives the difference quotient
Using ax+h=axah, this becomes
As h approaches zero, the factor ax remains fixed. Therefore, the derivative is
The limit is a constant determined by the base a; that constant is lna. Hence,
For example, when a=2, the constant is
So the rate of change of 2x is approximately 0.693 times the current value of 2x.
The base e is distinguished by satisfying lne=1. Therefore,
The derivative of the natural logarithm
The natural logarithm is the inverse of the exponential function. If
then equivalently
Differentiating this relationship gives
Since ey=x, this can be rearranged to obtain
Thus,
This derivative also gives a useful qualitative check: as x increases, 1/x decreases, so the graph of lnx becomes progressively less steep.
Deriving the alternating harmonic sum with calculus
Consider the function defined by the power series
For values of x with ∣x∣<1, differentiating term by term yields
This is a geometric series with first term 1 and common ratio −x, so
An antiderivative of 1/(1+x) is ln(1+x). Since F(0)=0, it follows that
Setting x=1 gives
The result depends on recognizing several connected patterns: differentiating the powers cancels their denominators, the remaining terms form a geometric series, and integrating the geometric-series expression produces a natural logarithm.
Key connections
Prime density: Near a large number x, the proportion of integers that are prime is approximately 1/lnx.
Prime powers and logarithms: Euler products built from primes become sums over prime powers when logarithms are taken.
Harmonic growth: The partial sum ∑k=1n1/k grows approximately like lnn, even though it diverges.
Natural logarithm and area: Since the derivative of lnx is 1/x, the area under 1/x from 1 to n is lnn.
Why base e is useful: The derivative of ex is itself, making exponential growth, logarithmic change, and calculus especially simple.
Alternating harmonic series: Alternating reciprocal terms converge to ln2, a result obtained by connecting a power series, a geometric series, and an integral.

Ask anything
We've read this whole study set, so questions about it get the best answers.