Looking for help to clearly define a function that counts the number of twin primes in a range

159 Views Asked by At

My goal is to define a function that counts the number of twin primes between $q$ and $q^2$ where $q$ is any prime greater than $7$.

I would like to do this using:

Here is my attempt. Please let me know if I make any mistakes or there is an easier way to define the function in terms of these two ideas.

Let $f_p(x) = $ the number of elements $y$ such that $x < y < x^2$ and $p = \text{lpf}\left[y(y+2)\right]$

I want to now define a function $t(x)$ where $t(x) = $ the number of twin primes pairs $z,z+2$ such that $x < z < x^2$ and $z,z+2$ are twin primes.

Here's my attempt at a definition based on $f_p(x)$

Let $t(x) = (x^2 - x) - \sum\limits_{p \le x} f_p(x)$

Did I do it correctly? Does $t(x)$ now count the number of twin primes that are between $x$ and $x^2$?

I ask because I posted a question (now deleted) with this assumption and everyone seemed confused by my reasoning.

1

There are 1 best solutions below

1
On BEST ANSWER

I would suggest a small correction on the domain of your functions, namely to take $x\leqslant y <x^2- 2$ and to put "$p<x$" on the sum of $f_p(x)$. This way $t(x)$ seems correct, since it counts exactly for how many $y\in[x,x^2-2)$ holds $\text{lpf}(y(y+2)) > x$, and it clearly implies $y,y+2$ both primes, otherwise there would be a divisor of $y(y+2)$ less than or equal $\sqrt{y+2} < x$.

Constructions like this are very common in (in fact, is the subject of study of) sieve theory, and the twin primes are somewhat a canonical example to illustrate the general ideas. The introductory remarks of the book Sieve Methods and the Chapter IV of the book Sequences, both from H. Halberstam, can enlighten a little more the concept of a sifting function.

For example, another way to define $t(x)$ is to take $$ \mathcal{A}_x := \{n(n+2):x\leqslant n<x^2-2 \} $$

and define $$t(x):=\left|\mathcal{A}_x\cap \left(\mathbb{Z}_+\setminus\bigcup_{p<x}p\mathbb{Z}\right)\right|$$

that is, the number of elements of $\mathcal{A}$ that are not divisible by $p$ for any $p<x$. It may seem a little different, but is essentially the same idea described by your method (sure it have to be, it's the same function after all!).