Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Project Euler 47, why is 2^2 considered a prime number distinct from 2?

Tags:

primes

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

like image 235
user2493615 Avatar asked Aug 12 '13 23:08

user2493615


People also ask

What are two distinct prime numbers?

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.

What is meant by distinct prime?

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.

Is 2 the only prime factor?

The number 2 is prime. (It is the only even prime.)


1 Answers

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.

like image 73
John Kugelman Avatar answered Jan 23 '23 17:01

John Kugelman