# How many numbers less than $x$ have a prime factor that is not $2$ or $3$

I am trying to figure out the number of integers greater than $1$ and less than or equal to $x$ that have a prime factor other than $2$ or $3$. For example, there are only two such integer less than or equal to $7$.

It is straight forward to determine how many many integers less than or equal to $x$ have a prime factor other than $2$:
$$x – \left\lfloor{\log}_2x\right\rfloor$$

Or to make the same determination about $3$:
$$x – \left\lfloor{\log}_3x\right\rfloor$$

What is the method or formula for figuring out how many integers less than or equal to $x$ have a prime factor other than $2$ or $3$?

I know that it is less than:
$$x – \left\lfloor{\log}_2x\right\rfloor – \left\lfloor{\log}_3x\right\rfloor$$

and greater than:
$$x – \left\lfloor{\log}_2x\right\rfloor – \left\lfloor{\log}_3x\right\rfloor – \left\lfloor\frac{x}{6}\right\rfloor$$

Thanks,

-Larry

Edit: Added a greater than clause.

#### Solutions Collecting From Web of "How many numbers less than $x$ have a prime factor that is not $2$ or $3$"

In Hardy’s book
of Twelve Lectures on Ramanujan’s work,
in the chapter
“A lattice point problem”,
he discusses Ramanujan’s result that

“the number of numbers
of the form
$2^x 3^y$
less than $n$
is

$\dfrac{\log(2n) \log(3n)}{2 \log 2 \log 3}$”

There is a very extended discussion
of this problem.
Among the results is a proof
that the error in
Ramanujan’s formula
is
$O(\frac{n}{\log n})$

The answer is $n – A(n)$ where $A(n)$ is the number of integers $\le n$ of the form $2^x 3^y$. Now $A(n)$ is the number of nonnegative integer solutions of $x \log 2 + y \log 3 \le \log n$, i.e. the number of lattice
points in the triangle $x \log 2 + y \log 3 \le \log n$, $x \ge 0$, $y \ge 0$.
This is within $O(\log n)$ of the area of the triangle, i.e. $\log(n)^2/(2 \log(2)\log(3))$. But I doubt you’ll get a “closed form” for the exact value.