@Sammm Yes you are correct. I wrote 2 by mistake. it should be i. because (log n)/log i = log n to the base i. So if i^m = n =>log n to the base i = integer.
@Lucifer I think that your approach is the best optimized. My algo is testing all the numbers while yours uses only prime factors of N. On Dec 27, 12:17 am, SAMMM <somnath.nit...@gmail.com> wrote: > @Sid small Modification in ur code in 3rd line it should be float ans > = log(n)/log(i); instead of float ans = log(n)/log(2); -- 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.