Given a integer N, with prime factorisation n1p1 * n2p2 …… The task is to check if the integer N is power-isolated or not.
An integer is said to be power-isolated if n1 * p1 * n2 * p2 ….. = N.
Input: N = 12 Output: Power-isolated Integer. Input: N = 18 Output: Not a power-isolated integer.
Approach: For an integer to be power-isolated the product of its prime factors and their power is equal to integer itself. So, for calculating same you have to find all prime factors of the given integer and their respective powers too. Later, calculate their product and check whether product is equal to the integer or not.
- Find the prime factor with their factor and store them in key-value pair.
- Later calculate product of all factors and their powers.
- if product is equal to integer, print true else false.
Below is the implementation of the above algorithm:
Power-isolated Integer Not a Power-isolated Integer Power-isolated Integer
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Check whether all the rotations of a given number is greater than or equal to the given number or not
- Check whether the given number is Euclid Number or not
- Check whether given number N is a Moran Number or not
- Check whether a given number N is a Nude Number or not
- Check whether a given number is an ugly number or not
- Check whether a given number is Polydivisible or Not
- Check whether the given number is Wagstaff prime or not
- Check whether a number has consecutive 0's in the given base or not
- Check whether the binary equivalent of a number ends with given string or not
- Check Whether a number is Duck Number or not
- Program to check whether a number is Proth number or not
- Check whether a given point lies inside a triangle or not
- Check whether the given numbers are Cousin prime or not
- Check whether the triangle is valid or not if angles are given
- Check whether Quadrilateral is valid or not if angles are given
- Check whether two points (x1, y1) and (x2, y2) lie on same side of a given line or not
- Check whether triangle is valid or not if three points are given
- Check whether a given matrix is orthogonal or not
- Check whether a number is circular prime or not
- Check whether a number has exactly three distinct factors or not
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.