3

Let $a,n$ be any positive integers.

Let $\varphi(x)$ be the Euler totient function.

It seems to me that the number of elements $x$ with $a \le x < a+n$ that have a given least prime factor will be less than each of the following expressions:

  • $\left\lfloor\dfrac{n}{2\#}\right\rfloor + 1$
  • $2\left\lfloor\dfrac{n}{3\#}\right\rfloor + 2$
  • $8\left\lfloor\dfrac{n}{5\#}\right\rfloor + 8$

  • $\vdots$

  • $\varphi(p\#)\left\lfloor\dfrac{n}{p\#}\right\rfloor + \varphi(p\#)$

Am I correct in this assumption? Will each of these expressions always be larger than the actual count of elements with a given least prime factor in a sequence of size $n$?

I ask because I made this assumption in a question I asked previously (now deleted) and I seemed to confuse everyone. One person asked why I was using $30$, I explained that $30 = 5\#$ and tried to explain that I was using it to count the elements with a given least prime factor.

I think that my explanation confused everyone more.

I am also wondering if there is a better way to estimate the number of elements with a given least prime factor in a such a sequence.

Larry Freeman
  • 10,189

1 Answers1

1

I found this to be an interesting question, that was also quite challenging for me to solve and determine how to best write this answer. Your upper bound expressions are valid, except for one minor point. You state the number of elements with a certain least prime factor ($\operatorname{lpf}$) will be less than your expressions. However, for the $\operatorname{lpf}$ of $2$ one, i.e., $\left\lfloor\frac{n}{2\#}\right\rfloor + 1$, with $n$ being odd gives $\frac{n + 1}{2}$, while with $a$ being any even number, the result will also be $\frac{n + 1}{2}$ (e.g., $n = 3$ and $a = 2$ gives $a$ and $a + 2$), so your upper bound is actually equal to the number. The algebra and explanations below are already somewhat complicated, so to help make them a bit simpler, I'm using less than or equal to.

First, with $p_j$ being the $j$'th prime, for integer $j \ge 0$, have $p_0 = 1$ and $p_0\# = 1$, plus define the set

$$A(a, n, j) = \{x \in \mathbb{N} : a \le x \lt a + n \land \gcd(x, p_j\#) = 1 \} \tag{1}\label{eq1A}$$

Also, for all positive integers $k$ define the set

$$B(a, n, k) = \{x \in \mathbb{N} : a \le x \lt a + n \land \operatorname{lpf}(x) = p_k \} \tag{2}\label{eq2A}$$

Next, note

$$A(a, n, k) \subseteq A(a, n, k - 1) \tag{3}\label{eq3A}$$

Since $A(a, n, k - 1)$ is the set of integers with no prime factors less than or equal to $p_{k - 1}$, it includes all those with factors of $p_k$ or higher. To get just those from this set which have a factor of $p_k$, so their $\operatorname{lpf}$ would be $p_k$, we need to exclude the integers which don't have a factor of $p_k$ since they will all have a $\operatorname{lpf}$ larger than $p_k$. This set to exclude not only has no factors of $p_{k - 1}$ or less, but also no factors of $p_{k}$, so they have no factors of $p_{k}$ or less. This is $A(a, n, k)$. Since this is a subset of $A(a, n, k - 1)$, as stated in \eqref{eq3A}, the set difference gives

$$\begin{equation}\begin{aligned} B(a, n, k) & = A(a, n, k - 1) \; \backslash \; A(a, n, k) \\ |B(a, n, k)| & = |A(a, n, k - 1)| - |A(a, n, k)| \end{aligned}\end{equation}\tag{4}\label{eq4A}$$

Regarding the number of elements in $A(a, n, j)$ in \eqref{eq1A}, note an integer $y$ will have $\gcd(y, p_j\#) = 1$ iff $\gcd(r, p_j\#) = 1$, where $r \equiv y \pmod{p_j\#}$ and $1 \le r \le p_j\#$. Thus, we can just focus on the relatively prime positive integers up to $p_j\#$, with their being $\varphi(p_j\#)$ of them. Also, any set of $p_j\#$ consecutive integers includes all of the congruences from $1$ to $p_j\#$ in some order. Thus, each group of $p_j\#$ integers, starting from $a$, has $\varphi(p_j\#)$ elements in $A(a, n, j)$, with any final partial set of $p_j\#$ integers possibly having up to $\varphi(p_j\#)$ more integers. Thus, the size of $A(a, n, j)$ has the following bounds

$$\varphi(p_j\#)\left\lfloor\frac{n}{p_j\#}\right\rfloor \le |A(a, n, j)| \le \varphi(p_j\#)\left\lceil\frac{n}{p_j\#}\right\rceil \tag{5}\label{eq5A}$$

To use this range to determine the bounds on $|B(a, n, k)|$ in \eqref{eq4A}, we could use the maximum of the first term minus the minimum of the second term. However, since the number of values in each consecutive group of $p_k\#$ integers is the same, we can just determine what it is for that group, i.e., have $n = p_k\#$, and then multiply by the integral number of such groups for the lower bound, and up to $1$ more for the upper bound. First, for each $p_k\#$ group,

$$\begin{equation}\begin{aligned} |B(a, p_k\#, k)| & = |A(a, p_k\#, k - 1)| - |A(a, p_k\#, k)| \\ & = \varphi(p_{k-1}\#)\left(\frac{p_k\#}{p_{k-1}\#}\right) - \varphi(p_{k}\#)\left(\frac{p_k\#}{p_{k}\#}\right) \\ & = \varphi(p_{k-1}\#)p_k - \varphi(p_{k}\#) \\ & = \varphi(p_{k-1}\#)p_k - (p_k - 1)\varphi(p_{k-1}\#) \\ & = \varphi(p_{k-1}\#) \end{aligned}\end{equation}\tag{6}\label{eq6A}$$

For example, with $p_4 = 7$ and $p_4\# = 210$, gives $B(1, 210, 4) = \{7, 49, 77, 91, 119, 133, 161, 203\}$, which has $\varphi(30) = 8$ elements. Using \eqref{eq6A} gives these bounds for all $n$

$$\varphi(p_{k-1}\#)\left\lfloor\frac{n}{p_k\#}\right\rfloor \le |B(a, n, k)| \le \varphi(p_{k-1}\#)\left\lceil\frac{n}{p_k\#}\right\rceil \tag{7}\label{eq7A}$$

For $k \ge 2$, your upper bound of $\varphi(p_k\#)\left\lfloor\frac{n}{p_k\#}\right\rfloor + \varphi(p_k\#)$ will always be larger, so it's also valid. Note, though, if $p_k\# \not\mid n$, then \eqref{eq7A} gives an upper bound of $\varphi(p_{k-1}\#)\left\lfloor\frac{n}{p_k\#}\right\rfloor + \varphi(p_{k-1}\#)$, so it's of the same form as yours, but with $\varphi(p_k\#)$ replaced by $\varphi(p_{k-1}\#)$.

John Omielan
  • 52,653