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
- Generate K co-prime pairs of factors of a given number
- Number of factors of very large number N modulo M where M is any prime number
- Number less than equals to N with maximum product of prime factors
- Efficient program to print all prime factors of a given number
- C Program for efficiently print all prime factors of a given number
- Product of divisors of a number from a given list of its prime factors
- Number of distinct prime factors of first n natural numbers
- Number with maximum number of prime factors
- Java Program for efficiently print all prime factors of a given number
- Check if a number is Prime, Semi-Prime or Composite for very large 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 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.