Some positive integers have exactly four positive factors. For example, 35 has only 1, 5, 7 and 35 as its factors. What is the sum of the smallest five positive integers that each have exactly four positive factors?
I know that the number of factors of a positive integer depends on its prime factorization. For example, 35 = 5 * 7, which has two prime factors. Each prime factor can be either included or not included in a factor of 35, so there are 2 * 2 = 4 possible factors. If a positive integer has exactly four positive factors, then it must have either two distinct prime factors, like 35, or one prime factor raised to the third power, like 8 = 2^3. So I need to find the smallest positive integers that are either the product of two distinct primes, or the cube of a prime. The smallest primes are 2, 3, 5, 7, 11, 13, and so on. The smallest cube of a prime is 2^3 = 8, which has factors 1, 2, 4, and 8. The next smallest cube of a prime is 3^3 = 27, which has factors 1, 3, 9, and 27. The smallest product of two distinct primes is 2 * 3 = 6, which has factors 1, 2, 3, and 6. The next smallest product of two distinct primes is 2 * 5 = 10, which has factors 1, 2, 5, and 10. The next smallest product of two distinct primes is 2 * 7 = 14, which has factors 1, 2, 7, and 14. The next smallest product of two distinct primes is 3 * 5 = 15, which has factors 1, 3, 5, and 15. I notice that the smallest five positive integers that each have exactly four positive factors are 6, 8, 10, 14, and 15. I add them up to get the answer. 