Ignore the last post. Updated: You don't need to use BigNum or long int for this program. Both n & k should be less than 1000. you need bignum only if there would be no restriction on k. Since both n,k are restricted, you don't need bignum. if n>5( 5^5 > 1000), simply reject the input and return false
On Fri, Jun 8, 2012 at 11:49 AM, Abhishek Sharma <abhi120...@gmail.com>wrote: > You don't need to use BigNum or long int for this program. > Both n & k should be less than 1000. > Since there is no restriction on k,you don't need Bignum > Since both n,k are restricted,you don't need bignum. > if n>5, simply reject the input and return false > > > On Fri, Jun 8, 2012 at 11:01 AM, Dave <dave_and_da...@juno.com> wrote: > >> @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. >> > > > > -- > Abhishek Sharma > Under-Graduate Student, > PEC University of Technology > > -- Abhishek Sharma Under-Graduate Student, PEC University of Technology -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. 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.