### Instruction: How many positive integers smaller than $1{,}000{,}000$ are powers of $2$, but are not powers of $8$? You may find it useful to consider that $2^{10}=1024$.### Response: I want to find all the numbers of the form $2^n$ where $n$ is a positive integer, such that $2^n<1{,}000{,}000$.
I also want to exclude those numbers that are also powers of $8$, since $8=2^3$.
So I need to avoid the numbers of the form $2^{3m}$ where $m$ is a positive integer.
The largest power of $2$ that is smaller than $1{,}000{,}000$ is $2^{19}$, since $2^{20}=1{,}048{,}576$.
So I need to check the values of $n$ from $1$ to $19$ and see which ones are not multiples of $3$.
I can use modular arithmetic to simplify this task.
If $n$ is a multiple of $3$, then $n\equiv 0\pmod 3$.
If $n$ is one more than a multiple of $3$, then $n\equiv 1\pmod 3$.
If $n$ is two more than a multiple of $3$, then $n\equiv 2\pmod 3$.
So I only want the values of $n$ that are congruent to $1$ or $2$ modulo $3$.
I can list them as follows: $n=1,2,4,5,7,8,10,11,13,14,16,17,19$.