We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Hi!
Because it is NOT looking for distinct primes in range [1,n], it is rather looking for the maximum distinct prime FACTORS of any number in the range.
All positive integer numbers can be represented by a multiplication of prime numbers, for example:
* 12, which is 2 * 2 * 3
* 30, which is 2 * 3 * 5
So, 30 has 3 distinct prime factors, while 12 has 2 distinct prime factors. If you take into account that 2*5*7=210, any number smaller than 210 would have a maximum of 3 distinct prime FACTORS.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Leonardo's Prime Factors
You are viewing a single comment's thread. Return to all comments →
Hi! Because it is NOT looking for distinct primes in range [1,n], it is rather looking for the maximum distinct prime FACTORS of any number in the range. All positive integer numbers can be represented by a multiplication of prime numbers, for example: * 12, which is 2 * 2 * 3 * 30, which is 2 * 3 * 5
So, 30 has 3 distinct prime factors, while 12 has 2 distinct prime factors. If you take into account that 2*5*7=210, any number smaller than 210 would have a maximum of 3 distinct prime FACTORS.