Project Euler 47 - Distinct Prime Factors

Official link:

Thought Process

I modified my Sieve of Eratosthenes function (Find it here). Instead of marking numbers with True or False indicating whether or not they are prime, it marks them with their number of prime factors. For example array[4] = 2, array[3] = 0.

I do this for the first million numbers and search through the array for the first sub-array of length 4 where all values of the sub array are equal to 4

Interactive Code

No interactive code for this one, code with explanation of modified sieve is given below