How would I get my code to reflect that? Should I just have it consider the number 4 to be prime?
Project Euler: Problem 47
A pair of distinct prime numbers are primes p,q such that p≠q. Multiplying two distinct prime numbers pq together gives a composite number whose prime factorization consists only of two primes. This composite number is divisible by 1,p,q,and pq. Nothing particularly fancy about them.
The distinct prime factors of a number are all the different primes which occur in this factorization. So the distinct prime factors of 24 are 2 and 3, and the distinct prime factors of 10 are 2 and 5.
The number 2 is prime. (It is the only even prime.)
The first three consecutive numbers to have three distinct prime factors are:
644 = 2² × 7 × 23
645 = 3 × 5 × 43
646 = 2 × 17 × 19.
If you factorize 644 you get 2 × 2 × 7 × 23. 644 has four prime factors, but three distinct prime factors.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With