Hi all!
I need a function to check if there exist numbers a and b so that n = a^b. I used this function and I thought it works correct, but it doesn't. Does anyone has any better solution?
Thanks
if (n == 1 || n == 2 || n == 3)
return 0;
unsigned long faktor = ceil(sqrt
) + 1 ;
for(unsigned long integral=2; integral<=faktor; integral++) {
double result=log10
/log10(integral);
if(fmod(result,1)==0) {
return 1;
}
}
return 0;
I need a function to check if there exist numbers a and b so that n = a^b. I used this function and I thought it works correct, but it doesn't. Does anyone has any better solution?
Thanks
if (n == 1 || n == 2 || n == 3)
return 0;
unsigned long faktor = ceil(sqrt
for(unsigned long integral=2; integral<=faktor; integral++) {
double result=log10
if(fmod(result,1)==0) {
return 1;
}
}
return 0;