Re: 10622 - Perfect Pth Powers
Posted: Thu Sep 04, 2014 12:14 am
Hi There, This is an explanation for the solution of the problem
Theorem:
All the powers in the prime factorization of an integer n is even iif n is a perfect square power number.
This Theorem can be extended to any perfect pth power, so we will say:
"All the powers in the prime factorization of an integer n is divisible by p iif n is a perfect p-th power number."
So what we need to do now is to get prime factorization for n and save all it's powers.
If n is -ve then multiply it by -1 to make it +ve, we will handle -ve later.
Then try all valid powers from 32 down to 1
if all powers are divisible by current tested valid power then we found a candidate solution but we need to check for one thing.
if the given number is +ve then we don't need to check for any thing, congratulations we found a solution.
if the given number is -ve then we should make sure that the valid power we found is odd in order to preserve the -ve value if so then we found a solution.
The reason for that is ex. 64 = 2^6 But -64 = -(2^2)^3 = -4^3
Hope That Helps.
------------------------------
Special Thanks: http://pavelsimo.blogspot.com/2012/06/u ... owers.html
Theorem:
All the powers in the prime factorization of an integer n is even iif n is a perfect square power number.
This Theorem can be extended to any perfect pth power, so we will say:
"All the powers in the prime factorization of an integer n is divisible by p iif n is a perfect p-th power number."
So what we need to do now is to get prime factorization for n and save all it's powers.
If n is -ve then multiply it by -1 to make it +ve, we will handle -ve later.
Then try all valid powers from 32 down to 1
if all powers are divisible by current tested valid power then we found a candidate solution but we need to check for one thing.
if the given number is +ve then we don't need to check for any thing, congratulations we found a solution.
if the given number is -ve then we should make sure that the valid power we found is odd in order to preserve the -ve value if so then we found a solution.
The reason for that is ex. 64 = 2^6 But -64 = -(2^2)^3 = -4^3
Hope That Helps.
------------------------------
Special Thanks: http://pavelsimo.blogspot.com/2012/06/u ... owers.html