Hello Samm I got your approach
It seems it is not working for some of the examples Eg: N = 6 6 = 2X3 = 1X6 and hence it is not possible but your code prints "Yes possible". On Dec 26, 9:03 pm, SAMMM <somnath.nit...@gmail.com> wrote: > From Wht I can understand from problm to check whether N can be > expressed a m^n : Eg: 1331=11^3 > > What comes to my mind is to get all prime factors from 2 to SQRT(N) > [Prime Sieve] , Here N is the Given Integer . > > Now Iterate over the prime number(p) from 2 to Sqrt(N) > do > T=N; > if(!(T%p)) while(!(T%p)) T/=p; > if(T==1) {printf("Yes possible");break;} > done > if (p>Sqrt(N)) printf("Not Possible"); -- 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.