A Prime Counting Gallery

3-3: Recentering, Extending to Rationals

Generalizing Alternating Series to Rationals

Okay. I think I followed the steps we just took in generalizing our alternating series to whole numbers. But you're suggesting we can generalize further?

Indeed... although when counting, we will no longer enjoy the luxury of counting over whole numbers. But we can still have an interesting recursive form.

I suppose that makes sense. So fine; how do we generalize further?

Well, moments ago I suggested that we could view the coefficient associated with normal alternating series as $$ a_{ 2 }(n) = 1-2 \left(\left\lfloor \frac{n}{2}\right\rfloor -\left\lfloor \frac{n-1}{2}\right\rfloor \right)$$

Correct. And then you generalized that to whole number numbers as $$ a_{ m }(n) = 1-m \left(\left\lfloor \frac{n}{m}\right\rfloor -\left\lfloor \frac{n-1}{m}\right\rfloor \right)$$

Right. Well, now I will generalize that statement even further. Suppose that $m$ no longer needs to be a whole number, but rather can be a rational fraction, $\frac{c}{b}$, where $b$ and $c$ are whole numbers. Then the generalization will look like so: $$ a_{ \frac{c}{b} }(n) = b \left(\left\lfloor \frac{n}{b}\right\rfloor -\left\lfloor \frac{n-1}{b}\right\rfloor \right)-c \left(\left\lfloor \frac{n}{c}\right\rfloor -\left\lfloor \frac{n-1}{c}\right\rfloor \right)$$

Oh, huh. And so if the denominator $b=1$, that does indeed reduce back to our prior definition, as one might hope.

True. And a bit of computational effort will suggest that our logarithm limit is still valid, as well.

Good, good. So how do we apply this specific generalization?

Using this Generalization

Well, I won't work through the nuts and bolts here, but if we are savvy in making use of $\alpha_{\frac{c}{b}}(n)$, we will arrive at a generalization that looks like this:

$$ \Pi(n) - \sum_{1 \le j \le \frac{\log n}{\log{\frac{c}{b}}}} \frac{(\frac{c}{b})^j}{j} = \sum _{\substack{ \frac{j}{b} \le n \\ j > b}} \frac{\alpha _{\frac c b}(j)}{b} -\frac{1}{2}\sum _{\substack{ \frac{j_1}{b} \cdot \frac{j_2}{b} \le n \\ j > b}} \frac{\alpha _{\frac c b}(j_1)}{b}\cdot \frac{\alpha _{\frac c b}(j_2)}{b} +\frac{1}{3}\sum _{\substack{ \frac{j_1}{b} \cdot \frac{j_2}{b}\cdot \frac{j_3}{b} \le n \\ j > b}} \frac{\alpha _{\frac c b}(j_1)}{b}\cdot \frac{\alpha _{\frac c b}(j_2)}{b}\cdot \frac{\alpha _{\frac c b}(j_3)}{b} - ... $$

Which is not, at all, a tidy recursive formula.

No, it's not, yet. As I mentioned, generalizing to the rationals means we no longer conveniently count over whole numbers, so that fact complicates our equations. But we can get back to a tidy formula without too much effort. Again, I'll skip past the messy details, as the steps are fairly straightforward but perhaps tedious.

But after a bit of work, with a new variable $d=\frac{1}{k}$ where $k$ is a whole number, and with a new, adjusted helper function $$\tau_{\rr{d}}(n)=(\lfloor n\rfloor -\lfloor n-{\rr{d}}\rfloor )-(1+{\rr{d}}) \left(\left\lfloor \frac{n}{1+{\rr{d}}}\right\rfloor -\left\lfloor \frac{n-d}{ 1+{\rr{d}}}\right\rfloor \right)$$ we can rewrite that messy definition above as our new, generalized-to-rationals recursive function

And so, with this generalized form, we will be computing $g_1(n, 1+d)$.

Ah, okay. And does it work like we expect?

Well, let's look at some examples. So here's $d = \frac{1}{2}$.

And that does behave exactly as we hoped.

It does.

I imagine we want to push $d$ down closer and closer to $0$, right? We want to treat it as a limit.

Let's try that. Here is $d = \frac{1}{10}$.

And so visually, anyway, it does look like the function is getting more and more centered on $y=0$, right? That's what I'm seeing, anyway.

It does seem that way, doesn't it. Well, let's try one more example, $d = \frac{1}{100}$.

Okay, heuristically it looks like the weighted count of prime powers is being recentered to the origin. I can go along with that. But what precisely are we seeing here?

So What Is This Curve?

What do you mean?

I assume this generalization is still subtracting out $$\displaystyle \sum_{1 \le k \le \log_{1+d} x} \frac{(1+d)^k}{k}$$ only now for values of $0 < d < 1$. But what exactly, in terms of equations, even is that sum?

Well, why don't we investigate it more explicitly? If $d=\frac{1}{2}$, we have

And for $d=\frac{1}{10}$, we see

That's really starting to resemble a smooth curve...

It is. Now let's try $d=\frac{1}{100}$, and this time I'll explicitly compare it to the logarithmic integral...

So what do you notice about this sum?

Well, on the one hand, it certainly looks like it's turning into the logarithmic integral as $x$ gets closer to $1$. I mean, you'd need to prove that, of course. But it does strongly resemble it.

True.

A Stumble, and Patching Up

But on the other hand, it also appears to be quite elevated compared to the logarithmic integral, for some reason.

Also true. As a matter of fact, if I were to graph with values of $x$ that get closer to $1$, the gap gets worse and worse. Look at this, for example...

That doesn't seem like the direction we want to go, I wouldn't think. It seems, unless I'm mistaken, that the curve is essentially converging, except that is has some tiny bias that seems to be slowly offsetting the entire function. Can this be patched up, somehow?

That is a serious issue, yes. So here are two ways to look at this problem. On the one hand, suppose we change the lower bound of our sum. Let's reject all values of $k$ less than $\log_x \mu$, where $\mu = 1.4513692348...$ is the Ramanujan–Soldner constant. Do that, and we will see this:

Huh. So do those two functions actually equal each other?

Well, with a bit of work, which I will omit it here, you can see that $$\lim_{d \to 0} \sum_{\log_{1+d} \mu \le k \le \log_{1+d} x} \frac{(1+d)^k}{k} = \int_{\log \mu}^{\log x} \frac{e^y}{y} \, d y = \mathrm{li}(x)$$

Fascinating. So what is the other approach to patching this up?

Well, alternately, let's adjust our sum by subtracting $1$ from the numerator. And then I want to compare it to a slightly different function. Doing so looks like this:

Okay, that's likewise quite suggestive. So do those two functions equal each other, then?

Again, with a bit of work that I will omit, you can see that $$\lim_{d \to 0} \sum_{1 \le k \le \log_{1+d} x} \frac{(1+d)^k - 1}{k} = \int_0^{\log x} \frac{e^y-1}{y} \, d y = \mathrm{li}(x) - \log \log x - \gamma$$

Got it.

A Significant Limit

Good. Let me restate where we've arrived. Given our recursive definition above, we have $$ \Pi(x) - \mathrm{li}(x) = \lim_{d \to 0} g_1(n,1+d) - \sum_{1 \le k \le \log_{1+d} \mu} \frac{(1+d)^k}{k} $$ and $$ \Pi(x) - \mathrm{li}(x) = -\log \log x - \gamma +\lim_{d \to 0} g_1(n,1+d) - H_{\lfloor \log_{1+d} x \rfloor}$$

And so, finally, $\lim_{d \to 0} g_1(n,1+d)$ expresses the difference between the weighted count of prime powers and the logarithmic integral, after a slight bit of patching up.

Exactly right, and exactly where we wanted to end up.

An Aside about Generalizing Alternating Series More Broadly

I should draw this discussion down, but before I do, let me leave a few breadcrumbs for exploring this topic of generalized alternating series a bit more fully if it grabs you.

Go ahead.

Okay. So, first we'll generalize to real values like so. Suppose $d$ is some real value $ > 0$. Then define the following core recursive function.

$$ \begin{align*} E'_k(n) &=\sum _{j=2} E'_{k-1}(\frac nj) -(1+d) \cdot \sum_{j=1} E'_{k-1}(\frac n{j (1+d)}) \\ E'_0(n) &= \begin{cases} 1 & n \ge 1 \\ 0 & \textrm{otherwise} \end{cases} \end{align*}$$

...Okay. Why that form?

Well, it expresses convolving generalized alternating series, while excluding an identity element. At any rate, do you remember our generalized divisor function, $d_z(n)$?

Sure.

We could, of course, have summed that up as $D_z(n) = \sum_{j=1}^n d_z(j)$. Well, now we will introduce a generalized alternating series equivalent of that, using $E'_k(n)$, as

$$ E_z(n) = \sum _{k=0}\binom{z}{k} E'_k(n) $$

And what can we do with that?

$D_z(n)$ and $E_z(n)$ can be expressed in terms of each other, like so.

$$ E_z(n) = \sum _{j=0}(-1)^j\binom{z}{j} (1+d)^{j} \cdot D_z(\frac n{(1+d)^j})$$ $$ D_z(n) =\sum _{j=0}(-1)^j \binom{-z}{j} (1+d)^{j} \cdot E_z(\frac n{(1+d)^j})$$

Oh - that must mean, since you just defined $E_z(n)$ in terms of $E'_k(n)$, that $D_z(n)$ can also be expressed with $E'_k(n)$, right?

Right.

$$ D_z(n) =\sum _{j=0}\sum_{k=0}(-1)^j \binom{-z}{j} \binom{z}{k} (1+d)^{j} \cdot E'_k(\frac n{(1+d)^j})$$

And then, in turn, we are curious about certain special values of $z$. Namely, if $z=2$, we have $D(n)$, the divisor summatory function, if $z=-1$, we have $M(n)$, the Mertens function, and of course $\lim_{z \to 0} \frac{D_z(n)-1}{z} = \Pi(n)$, our weighted count of prime powers.

$$ \Pi (n)=\sum _{k=1}\frac 1 k \cdot ((1+d)^k \cdot E'_0(\frac n{(1+d)^k})+(-1)^{k+1} E'_k(n))$$ $$ D(n)=\sum _{j=0}(j+1)(1+d)^j( E'_0(\frac n{(1+d)^j}) +2 E'_1(\frac n{(1+d)^j})+ E'_2(\frac n{(1+d)^j})) $$ $$ M(n)=\sum _{k=0}(-1)^k( E'_k(n) -(1+d) \cdot E'_k(\frac n{1+d}) ) $$

Well, fine. Is this useful, though?

I'm not sure. I just wanted to leave the raw material for you to explore it yourself, that's all. So here's JavaScript code to do exactly that.

As usual, remember that these functions are live in the browser's console, if you tap F12.

A screen shot of tapping F12 and testing these functions in the live browser JavaScript console
Testing the functions in the browser

Let me connect this to more typical number theory ideas, quickly.

Sure.

We can generalize $E'_k(n)$ by adding an $s$ parameter like so. $$ E'_k(n) =\sum _{j=2} j^{-s} \cdot E'_{k-1}(\frac nj) -(1+d) \cdot \sum_{j=1} (j(1+d))^{-s} \cdot E'_{k-1}(\frac n{j (1+d)})$$ If the real part of $s > 0$, we can take the following limit. $$\lim_{n \to \infty}E'_k(n) = ((1-(1+d)^{1-s}) \zeta(s)-1)^k $$

At any rate, let's move on.

Connecting to $\zeta(s)$

Alright. This has been quite a journey. Does this all connect back to the Riemann zeta function, too?

Of course, with a bit of work. So if you took our original function $g_k(n,j)$ above, you could parameterize it by introducing a complex parameter $s$ and you'd have $$g_k(n,j)=\rec{\rr{j^{-s} (-1)^{j+1} \cdot (}\frac{1}{k}-g_{k+1}(\frac{n}{j},2)\rr{)} + g_k (n, j+1)}$$

And if we do that, what does it equal?

In that case, $$g_1(n,2) = \sum_{j=2}^{n} \frac{\Lambda(j)}{\log j} \cdot j^{-s} - \sum_{1 \le k \le \log_{2} n} \frac{2^{(1-s)k}}{k}$$

And then if the real part of $s$ were greater than $0$, you could take the limit as $n$ went to infinity, and you'd arrive at $$\log (1-2^{1-s}) + \log\zeta(s) = \sum_{k=1}^\infty \frac{(-1)^{k+1}}{k}((1-2^{1-s})\zeta(s)-1)^k$$

Wait, if the real part of $s$ is $>0$? Previously our sums connected to $\zeta(s)$ only converged when the real part of $s$ was $>1$, right?

Well-spotted, yes. But here, we get convergence if the real part of $s>0$. You can read more by finding any good reference on $\eta(s)$, the Dirichlet eta function, defined as $\sum_{k=1}^\infty (-1)^{k+1} \cdot k^{-s}$. It's commonly referred to precisely because it has the same non-trivial zeros as the Riemann zeta function, but its basic definition converges everywhere the non-trivial zeros might plausibly exist.

Above, we worked through the generalized alternating series "recentering" the count of primes, so to speak. Is that conceptually related to why the series has a wider range of convergence here?

It's a reasonable thought, isn't it. Anyway, I would like to move on, because I have another observation I find quite fascinating.

What's that?

In an earlier discussion, we generalized our recursive form to a rational fraction. Well, now we can add a complex parameter $s$ to that definition too. If we have the helper function $$\tau_{ {d}}(n)=(\lfloor n\rfloor -\lfloor n-{ {d}}\rfloor )-(1+{ {d}}) \left(\left\lfloor \frac{n}{1+{ {d}}}\right\rfloor -\left\lfloor \frac{n-d}{ 1+{ {d}}}\right\rfloor \right)$$ then our recursive form is $$g_k(n,j)=\rec{ \rr{j^{-s}} \cdot {\tau_d(j) \cdot }(\frac{1}{k}-g_{k+1}(\frac{n}{j},1+{d})) + g_k (n, j+{d})}$$ where $d = \frac{1}{t}$ with $t$ some whole number. And so that function equals $$g_1(n,1+d) = \sum_{j=2}^{n} \frac{\Lambda(j)}{\log j} \cdot j^{-s} - \sum_{1 \le k \le \log_{1+d} n} \frac{(1+d)^{(1-s)k}}{k}$$

Right. And if we take the limit as $n \to \infty$ for suitable $s$, I imagine that becomes $$\log (1-(1+d)^{1-s}) + \log\zeta(s) = \sum_{k=1}^\infty \frac{(-1)^{k+1}}{k}((1-(1+d)^{1-s})\zeta(s)-1)^k$$ But what is fascinating about any of that?

Well, I suppose that tastes may vary, of course. But the sum $$\sum_{1 \le k \le \log_{1+d} n} \frac{(1+d)^{(1-s)k}}{k}$$ is behaving in a really quite striking fashion here.

How so?

Well, as we just saw, and given a suitable value for $s$, taking a limit of $n \to \infty$ turns that sum into the very familiar form of a Taylor series as $$-\log \left(1-(1+d)^{1-s}\right)$$ On the other hand, that exact same sum, if you instead take a limit as $d \to 0$, and assuming you subtract out $H_{\lfloor \log_{1+d} n \rfloor}$, turns into $$\mathrm{li}(n)-\log \log n - \gamma$$ At least for me, that property immediately suggests all sorts of questions about other Taylor series that I'd like answers to...

Ah, I see.

It's just a fascinating connection, at least to me. I must admit I'm drawn to such things. Anyway, I think I've made my point. Let's go to the next idea.