Given an integer . The task is to find the superpower from the factorization of .
The Superpower is the highest power among the power of primes in the factorisation of a number n.
Input : n = 32 Output : 5 Input : n = 240 Output : 4
For finding the superpower of any given number , we have to complete the factorisation of n, and find out highest power among all of the prime factors.
Note: Using Sieve for the purpose of storing list of primes is useful in terms of optimization.
- Itereate over primes and calculate the factorization of n.
- For each prime among the stored list of primes and which is also a factor of n,
find its power and check it for super power.
Below is the implementation of the above approach:
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.
- Find whether a given number is a power of 4 or not
- Find the minimum number to be added to N to make it a power of K
- Find last five digits of a given five digit number raised to power five
- Find maximum power of a number that divides a factorial
- Find the sum of power of bit count raised to the power B
- Super-Poulet Number
- Find power of power under mod of a prime
- Check if given number is a power of d where d is a power of 2
- Check if a large number is divisible by a number which is a power of 2
- Program to find whether a no is power of two
- Find value of y mod (2 raised to power x)
- Find the first and last M digits from K-th power of N
- Find whether a given integer is a power of 3 or not
- Check if the number is a Prime power number
- Highest power of a number that divides other number
- Given two numbers as strings, find if one is a power of other
- Find multiple of x closest to or a ^ b (a raised to power b)
- Find unit digit of x raised to power y
- Power of a prime number ‘r’ in n!
- Sum of digits of a given number to a given power
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.
Improved By : Mithun Kumar