Given a number N. The task is to check whether the given number N has unique prime factors or not. If yes then print YES else print NO.
Input: N = 30
N = 30 = 2*3*5
As all the prime factors of 30 are unique.
Input: N = 100
N = 100 = 2*2*5*5
As all the prime factors of 100 are not unique because 2 and 5 are repeated twice.
- Find all the prime factors of the given number N using Sieve Of Eratosthenes.
- If the product of all the prime factors obtained is equals to N then all prime factors are unique, so print YES.
- Else print NO.
Below is the implementation of the above approach:
Time Complexity: O(N*log(log N)), where N is the given number.
- Print all numbers whose set of prime factors is a subset of the set of the prime factors of X
- Check if a number exists having exactly N factors and K prime factors
- Maximum number of prime factors a number can have with exactly x factors
- Maximum number of unique prime factors
- Product of unique prime factors of a number
- Count numbers in a given range whose count of prime factors is a Prime Number
- Find number of factors of N when location of its two factors whose product is N is given
- Number of factors of very large number N modulo M where M is any prime number
- Check if there exists a number with X factors out of which exactly K are prime
- Efficient program to print all prime factors of a given number
- C Program for efficiently print all prime factors of a given number
- Java Program for efficiently print all prime factors of a given number
- Check whether a number has exactly three distinct factors or not
- Number with maximum number of prime factors
- Number which has the maximum number of distinct prime factors in the range M to N
- Check whether the sum of prime elements of the array is prime or not
- Print all prime factors and their powers
- Number of steps to convert to prime factors
- Prime factors of a big number
- Number of distinct prime factors of first n natural numbers
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.