@victor: But if K <= 1000, then the largest N you have to deal with is 4, 
since 4^4 < 1000 but 5^5 > 1000. So your code looks like this:
 
int IsNtoNEqualK( int N, int K)
{
    return (N==1)&&(K==1) || (N==2)&&(K==4) || (N==3)&&{K==27) || 
(N==4)&&(K==256);
}
 

On Thursday, June 7, 2012 5:14:00 PM UTC-5, Victor Manuel Grijalva 
Altamirano wrote:

> Hi, everybody!!!
> I have the follow quest... 
>
> I have two numbers N and K,  i need to check that N^N = K.
> for example:
>                   if N=2 and K=4 ,     2^2 = 4 so return true;
>                   if N=3 and K=26 ,   3^3 != 26 so return false
> But 0<=N , K<=1000 so N^N could be have 1000 digits.
>
> I program in C++, and i can use Bignum (array manipulation) + fast 
> power(binary power) but i want to know if exist a mathematical property.      
>    
>
> -- 
> Victor Manuel Grijalva Altamirano
> Universidad Tecnologica de La Mixteca
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/s6ahKx0Sxe8J.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to