# Number of perfect cubes n, $\in 1\leq{n}\leq{a}$, $a\in{Z^+}$ that aren't divisible by 3.

As the question reads; How many perfect cubes n, $\in 1\leq{n}\leq{a}$, $a\in{Z^+}$ exist in terms of $a$ that aren't divisible by 3?
I'm looking for a formula in terms of $a$, to achieve this number. Trivially, the number of all perfect cubes less than a given $a$, will be $\lfloor{\sqrta}\rfloor$. But, what adjustment can be made to remove those that are multiples of $3$?

## 2 Answers

• Number of perfect cubes between $1$ and $a$, is equal to $\lfloor \sqrta \rfloor$;
• also the number of perfect cubes between $1$ and $a$ which are divisible by $3$, is equal to $\lfloor \dfrac{\sqrta}{3} \rfloor$;

so we can conclude that:

• number of perfect cubes between $1$ and $a$ which are not divisible by $3$,
is equal to $\lfloor \sqrta \rfloor - \lfloor \dfrac{\sqrta}{3} \rfloor$.

A perfect cube $m^3$ is a multiple of $3$ if and only if $m$ is a multiple of $3$. So determine how many multiples of $3$ there are from $1$ to $\lfloor \sqrta\rfloor$ and then substract.