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.
- Product of unique prime factors of a number
- Maximum number of unique prime factors
- Check if a number exists having exactly N factors and K prime factors
- Check if there exists a number with X factors out of which exactly K are prime
- Maximum number of prime factors a number can have with exactly x factors
- Print all numbers whose set of prime factors is a subset of the set of the prime factors of X
- Prime factors of a big number
- Sum of Factors of a Number using Prime Factorization
- Number which has the maximum number of distinct prime factors in the range M to N
- Number of steps to convert to prime factors
- Number of factors of very large number N modulo M where M is any prime number
- Efficient program to print all prime factors of a given number
- C Program for efficiently print all prime factors of a given number
- Number of distinct prime factors of first n natural numbers
- Java Program for efficiently print all prime factors of a given number
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.