The Sieve of Eratosthenes as sum of square waves

I wrote this equation, that is a way to represent the Sieve of Eratosthenes:

$-1+\sum\limits_{i=2}^{\infty} ( 2 \left \lfloor \frac {x}{i} \right \rfloor - \left \lfloor \frac {2x}{i} \right \rfloor +1) (2 \left \lfloor \frac {i+2x-2}{2i} \right \rfloor - \left \lfloor \frac {i+2x-2}{i} \right \rfloor +1)=0$

The solutions are all the prime numbers, and only them.

The function

$y=-1+\sum\limits_{i=2}^{\infty} ( 2 \left \lfloor \frac {x}{i} \right \rfloor - \left \lfloor \frac {2x}{i} \right \rfloor +1) (2 \left \lfloor \frac {i+2x-2}{2i} \right \rfloor - \left \lfloor \frac {i+2x-2}{i} \right \rfloor +1)$

is also a divisor function, because its values represent the number of proper divisors for every integer $x>1$.

Inside the sum, the first factor produces a square wave of period $i$ and amplitude of 1. The second factor reduces the duty cycle of the first wave to 1.

As for the Sieve of Eratosthenes, to calculate all the prime numbers not greater than a number n, the sum can be stopped at $i=\sqrt{n}$.

It seems to me an original function. Is it of some interest? Can it be simplified? Is there any way to evaluate the equation, that is to bring the x to the left, outside the floor functions and the sum?

square waves: $i=4$

$i=9$

The complete value

See the primes: 2,3,5,7,11,13,17,19 where the value is zero.

• can it be plotted somehow? for instance, you are mentioning square waves, how does it look like? maybe visualizing it could be a first step to understand if it provides a possible new view of the problem or not. Just a suggestion! – iadvd Aug 19 '15 at 13:22
• Sure, it can be plotted with every function drawer who has sum and floor capabilities. I did it with Graph, that is a very simple and free function drawer. This is my first question on this forum, I have not enough reputation (min. 10) to insert images. Thanks for the suggestion! – Diego Chillo Aug 19 '15 at 13:41
• I'll insert some images. – GEdgar Aug 19 '15 at 13:43
• @DiegoChillo cool! it is always better to see graphs to understand how it works :) – iadvd Aug 19 '15 at 14:21
• @GEdgar Thanks a lot for the images, they couldn't have been more clear – Diego Chillo Aug 20 '15 at 17:16

It's a very nice equation, but I don't think it's very effective. If you want to check if $a\ |\ b$ with your equation, it will take way longer than just doing $a/b$. And sadly there is no way to bring the $x$ to the left, since $$\lfloor x \rfloor$$ won't tell you the exact value of $x$

The OP's functions are defined as follows.

(1) $$\quad a(x,n)=\left(2\left\lfloor\frac{x}{n}\right\rfloor-\left\lfloor\frac{2\,x}{n}\right\rfloor+1\right)\left(2\left\lfloor\frac{n+2\,x-2}{2\,n}\right\rfloor-\left\lfloor\frac{n+2\,x-2}{n}\right\rfloor+1\right)$$

(2) $$\quad f(x,N)=-1+\sum\limits_{n=2}^N a(x,n)$$

The $$a()$$ and $$f()$$ functions defined above can also be written as the $$b()$$ and $$g()$$ functions defined below.

(3) $$\quad b(x,n,K)=\sum\limits_{k=1}^K(\theta(x-n\,k)-\theta(x-(n\,k+1)))$$

(4) $$\quad g(x,N,K)=-1+\sum\limits_{n=2}^N b(x,n,K)$$

The following plot for $$g(x,20,10)$$ matches the corresponding plot in the OP's question above. The red discrete portion of the plot illustrates the evaluation at integer values of $$x$$.

Figure (1): $$g(x,20,10)$$

The following plots illustrate the effect of the parameter $$N$$ on the evaluation of the $$f()$$ and $$g()$$ functions defined in (2) and (4) above. The red discrete portion of the plot illustrates the evaluation at integer values of $$x$$.

Figure (2): $$g(x,10,10)$$

Figure (3): $$g(x,5,10)$$

Figure (4): $$g(x,\sqrt{x}+1,10)$$

Figure (5): $$g(x,\sqrt{x},10)$$

I've briefly investigated the following related Dirichlet series.

(5) $$\quad B(s,n,K)=\sum\limits_{k=1}^K\left((k\,n)^{-s}-(k\,n+1)^{-s}\right)$$

(6) $$\quad G(s,N,K)=\sum\limits_{n=2}^N B(s,n,K)$$

The most interesting result is for B(s,2,K) evaluated along the critical line $$s=1/2+i\,t$$. The following plots are all evaluated at $$K=1000$$. The red discrete portion of the plot illustrates the evaluation at the first 10 non-trivial zeta zeros in the upper half plane.

Figure (6): $$\left|B(\frac{1}{2}+i\,t,2,1000)\right|$$

Figure (7): $$\Re(B(\frac{1}{2}+i\,t,2,1000))$$

Figure (8): $$\Im(B(\frac{1}{2}+i\,t,2,1000))$$

Figure (9): $$\arg(B(\frac{1}{2}+i\,t,2,1000))$$

The results illustrated in Figures (6) to (9) above seem to imply the function $$C(s,K)=B(s,2,K)-1$$ has the same zeros as $$\zeta(s)$$ along the critical line. The following plot illustrates $$\left|C(\frac{1}{2}+i\,t,1000)\right|$$ where the red discrete portion of the plot illustrates the evaluation at non-trivial zeta zeros.

Figure (6): $$\left|C(\frac{1}{2}+i\,t,1000)\right|$$

Mathematica tells me $$C(s,\infty)$$ simplifies to the following:

(7) $$\quad C(s,\infty)=\left(2^{1-s}-1\right)\zeta(s)$$

The function $$C(s,\infty)$$ is related to Dirichlet eta function $$\eta(s)$$ as follows.

(8) $$\quad\eta(s)=\sum\limits_{k=1}^\infty (-1)^{k-1}k^{-s}=-C(s,\infty)$$