December 23, 2022
Útulek Series, 3 | CF1761D Chapter, 3
I want to start this post by addressing something obvious that I missed in the previous post, which only occurred to me in my sleep.
Recall we were solving Pell equations, and came up with this general recurrence ():
which we stated in corollary lends itself quite easily to a matrix exponentiation solution:
I also put forth the observation that the non-recursive Pell equation solution, derived from eigenvalue decomposition of corollary in Pell Equations Have Infinite Solutions, is remarkably similar to Binet’s formula for the Fibonacci sequence:
In hindsight, it is obvious why this is the case. I put forth the hypothesis in 2D Recurrences and Combinatorial Arguments that “all twin (and likely higher orders) two-dimensional recurrences can be simplified into single two-dimensional recurrences via repeated substitution”. Allow me to state this conjecture more rigorously:
Conjecture 1.2 (Recurrence Detanglement): -variate, -order, -degree, -dimensional recurrences may always be reduced to disjoint single-variable, -order, -degree, -dimensional recurrences.
Here, I use the terminology -variable to mean sequences of variables, order to denote the number of terms to be added together for each recurrence, degree to denote the maximum power of terms we see multiplied together, and dimension to denote the number of indices we use to label each variable sequence.
I do not have the proof ready for this claim (I suspect it reduces to eigenvalue decomposition on some -by- matrix), but I will first demonstrate conjecture ’s viability in the Pell equation . Starting with bivariate recurrences
we may make the repeated substitution
and similarly for :
And indeed, this is now a single-variable, 1-order, 1-dimensional recurrence as hypothesized in conjecture , which is also the same type of recurrence as the Fibonacci. The similarity in form, then, can fully be explained from this point with the observation that both the Fibonacci recurrence and may be written in similar matrix form and decomposed into eigenvalues.
A proper exploration into the recurrence detanglement in conjecture will likely lead us onto the path to discover why the bivariate, 3-order, 1-degree, 2-dimensional recurrence of 1761D in 2D Recurrences and Combinatorial Arguments
results in a sum over combinations. But we will take our time getting there.
First, we must cover the linear sieve.
Legend has it that in the 1600s, Fermat gave the Pell equation with ,
to his clergyman friend Wallis as a challenge, of which the minimal solution is
Wallis (and another friend of Fermat’s, who also received the challenge) did manage to solve it, but I imagine it was not without trudging through much manual arithmetic. I’m uncertain if the method of continued fractions was known at the time, but even then, it is no easy task to come up with the solution above.
It is impressive for a clergyman! And perhaps saddening, when one considers the clergymen of the modern times. This incident also harkons to the problem-sharing happening in my competitive programming (CP) circles, between me and Neal, Tony, Sanjeev, Wyatt, Zac, and others. Perhaps one of us will be in the textbooks of the future as the idiot who spent a whole week on a problem that his (much more experienced) friend posed as a joke.
From his Wikipedia page, it seems that Wallis is most famous for the Wallis product
which certainly evokes memories of Euler’s derivation of the Riemann zeta function at (which sounds scary, but is defined simply):
Unfortunately this evocation is no coincidence, and Euler’s method for deriving unfortunately does trivialize Wallis’s derivation of his own product. Luckily, both derivations are tangential to our upcoming investigation into the Linear Sieve and Taylor’s Series, and I intend to discuss when the time is right.
First, we need to establish the growth rates of the harmonic and prime harmonic series.
In CP, the well-known method to determine the prime numbers is the Sieve of Eratosthenes:
is_prime = [true, true, ...]
for i = 2 to N:
if is_prime[i]:
for j = i*i to N by i:
is_prime[j] = false
which is quoted to . Of course, $\ln\ln$s are uncommon and should raise some eyebrows. We can loosen the algorithm a little by starting the inner loop at instead of , which roughly gives us the big-O runtime estimate
with denoting the -th prime number.
We will use the convention that denotes the -th term in a sequence, and denotes the sum of the first terms in the sequence, or alternatively the -th term in the corresponding series. Thus, will refer to the (possibly divergent) sum of the infinite series.
is, of course, a subset of the Harmonic Series, which I believe is taught in most high school classes today:
but only to the extent that the harmonic series diverges. The proof proceeds by grouping the terms of the sequence in groups of size of increasing powers of two:
of which the terms in each group are lower-bounded by subsequently smaller powers of two:
whose grouped sum reduces nicely into an arithmetic series, which obviously diverges:
The beautiful part about this proof of divergence is that it also gives us the big-O rate of growth of the series , which, based on the exponentially increasing size of the groups, is . One can also arrive at this conclusion by examining the integral of series, which approximates the series itself:
In fact, if we are even more precise with our integrals, we can bound fairly closely,
Fermat and Euler were unfortunate enough to live at a time where notation to describe the growth rate of functions was not widespread. The great mathematicians of the late 1700s, such as Gauss, Legendre, Fermat, Euler (who, as I have learned, was a student of Bernoulli’s—an unfortunate reality, as I have far more respect for the number theorists than statisticians), Dirichlet, and Chebyshev all almost certainly played with the idea of the prime number theorem (PNT), which is best stated as a theorem of function growth rates.
Theorem 4.1 (PNT): The number of primes less than , , is . That is, a proportion of approximately of the first numbers are prime.
Of course, the reason these great mathematicians were unable to prove the PNT is because its proof is fairly involved. Hence, said proof will lie outside the scope of this series of posts, at least until we introduce some ideas from introductory complex analysis. It’s truly a shame, though, since from the PNT one may be able to deduce the importance of complexity analysis to mathematics at large—but of course, complexity analysis was not formalized until more rigorous study of algorithms.
The PNT does, however, give some intuition into the growth rate of the prime harmonic series . We already have that the prime harmonic series is bound by the harmonic series with . Supposing we take of every terms in the harmonic series, by PNT, the number of terms we take grows at the same rate as the number of terms in . This sieved harmonic series necessarily grows at .
However, this is a lower bound, since we know by PNT that primes also occur more frequently for smaller numbers. Hence, the growth rate of the prime harmonic series must lie between and .
Few runtimes lie in the real between and . Most commonly, there are three:
With little time remaining, I’d like to introduce the “golden bridge” which is Euler’s product formula:
which can actually be easily generalized to integer values of the zeta function.
Theorem 5.1 (Euler’s Product Formula):
This is, to understate nothing, a huge deal. One may see inklings of the prime harmonic series on the RHS of Euler’s product formula. My proof of it requires the use of the Taylor series for , so I will begin next time by introducing this. In the meantime, it may be a good use of time to review Taylor series from Tony’s blogpost Taylor expansions: An easy derivation.