Numbers With 3 Divisors
August 30, 2019
I saw this question on Stack Overflow a few days ago; it’s a well-known problem in number theory:
For a given number n, how many numbers less than n have exactly 3 divisors?
Your task is to write a program that counts the numbers less than n that have exactly 3 divisors, and use it to find the result when n is one billion. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.