How many integers $\leq N$ are divisible by $2,3$ but not divisible by their powers?

198 Views Asked by At

How many integers in the range $\leq N$ are divisible by both $2$ and $3$ but are not divisible by whole powers $>1$ of $2$ and $3$ i.e. not divisible by $2^2,3^2, 2^3,3^3, \ldots ?$

I hope by using the inclusion–exclusion principle one may derive such a formula and part of the formula has a form $$ N-\left[\frac{N}{2} \right]+\left[\frac{N}{2^2} \right]-\left[\frac{N}{2^3} \right]+\cdots -\left[\frac{N}{3} \right]+\left[\frac{N}{3^2} \right]-\left[\frac{N}{3^3} \right]+\cdots+\left[\frac{N}{2 \cdot 3} \right]+\text{some terms like as $\pm \left[\frac{N}{2^i \cdot 3^j} \right]$} $$

Question. What is the exact sign for a term $ \left[\frac{N}{2^i \cdot 3^j} \right]$?

2

There are 2 best solutions below

1
On BEST ANSWER

We want to count those numbers divisible by $6=2\cdot3$, but not those divisible by $12=2^2\cdot3$ or $18=2\cdot3^2$. However, if we count both those numbers divisible by $12$ and those divisible by $18$, we've counted those divisible by $36$ twice. Therefore, the count should be $$ \left\lfloor\frac N6\right\rfloor-\left\lfloor\frac N{12}\right\rfloor-\left\lfloor\frac N{18}\right\rfloor+\left\lfloor\frac N{36}\right\rfloor $$

10
On

The rules permit all numbers divisible by $6$, but excluding those also divisble by $4$ or $9$.

This is given by:

$$\lfloor\frac{N}{6}\rfloor-\lfloor\frac{N}{12}\rfloor-\lfloor\frac{N}{18}\rfloor+\lfloor\frac{N}{36}\rfloor$$

Firstly - Start by enumerating number of numbers divisible by 6.

Next term: Remove numbers divisible by 6 and 4. These are all numbers divisible by 12 since the intersection of prime factors is $3\times2^2$

Next term: Remove numbers divisible by 6 and 9. These are all numbers divisible by 18 since the intersection of prime factors is $2\times3^2$

Next term: Add back in the multiples of 36 since these are the numbers we have deducted twice; divisible by 6, 4, and 9. Intersection of prime factors is $2^2\times3^2$.