Call a number prime-looking if it is composite but not divisible by 2, 3, or 5. The three smallest prime-looking numbers are 49, 77, and 91. There are 168 prime numbers less than 1000. How many prime-looking numbers are there less than 1000?
Now, let us see what we can do:
There are 999 / 2 =499 numbers that are divisible by 2
There are 999/3 =333 that are divisible by 3. But 166 of them are and are included in 499. But 167 are odd which are not included in 499 above.
So, we have: 499 + 167 =666
We have:999/5=199. But only 100 are odd and end in 5. So, we have:
666 + 100 =766. But, 999/15 =66 half of which are already inculded that end in 5 and are divisible by 3. So, we have: 766 - 33 =733 + 1 itself - 3 primes(2, 3, 5) =731 + 168 primes=899.
So, 999 - 899 = 100 prime-looking numbers under 1,000.
Here is another way of looking at this problem, which ends with the same result as figured above:
There are 31 primes between 7 and 139 =31[This means that prime numbers from 7 and up can be squared or multiplied by each other to get the desired numbers such as: 7^2, 7*11, 7*13...and so on.
There are 20 primes between 11 and 90=20
There are 16 primes between 13 and 76 =16
There are 10 primes between 17 and 58 =10
There are 8 primes between 19 and 52 =8
There are 6 primes between 23 and 43 =6
There are 2 primes between 29 and 34 =2
There is 1 prime between 31 and 32 =1
That is a total =31 + 20 + 16 + 10 + 8 + 6 + 2 + 1 =94
There is 7^3 for an additional number
There are 7^2*11, 7^2*13, 7^2*17, 7^2*19 = 4 additional numbers.
There is 11^2*7 for 1 additional number.
So, the grand total =94 + 1 + 4 + 1 =100 prime-looking numbers under 1,000.