Project Euler Problem 47 Solution

Question

The first two consecutive numbers to have two distinct prime factors are:

14=2×715=3×5\begin{aligned} 14 & = 2 \times 7 \\ 15 & = 3 \times 5 \end{aligned}

The first three consecutive numbers to have three distinct prime factors are:

644=22×7×23645=3×5×43646=2×17×19\begin{aligned} 644 & = 2^2 \times 7 \times 23 \\ 645 & = 3 \times 5 \times 43 \\ 646 & = 2 \times 17 \times 19 \end{aligned}

Find the first four consecutive integers to have four distinct primes factors. What is the first of these numbers?

Haskell

Python

Ruby