On Mon, Nov 23, 2009 at 3:57 PM, Saurabh Aggarwal <saurabh...@gmail.com>wrote:
> Could you explain it with an example ? > > I hope you are considering that n^n may be well beyond any datatype range. Yes I am considering n to be well beyond any datatype range. > > > > On Mon, Nov 23, 2009 at 3:24 PM, Bharath <bharath1...@gmail.com> wrote: > >> For first k digits: >> >> (unsigned long)floor(pow(10.0, modf(n*log10((double)n), &dummy) + k - 1)) >> >> >> On Mon, Nov 23, 2009 at 3:24 PM, Bharath <bharath1...@gmail.com> wrote: >> >>> For last k digits >>> >>> int foo(int n, int k) >>> { >>> int m=1; >>> for(; k > 0; k--) m*=10; >>> >>> int r=1, t=n % m; >>> while(n) >>> { >>> if (n % 2) >>> r = r * t % m; >>> t = t * t % m; >>> n >>= 1; >>> } >>> >>> return r; >>> } >>> >>> On Sat, Nov 21, 2009 at 9:44 AM, Siddharth Prakash Singh < >>> sps...@gmail.com> wrote: >>> >>>> Can anybody suggest an algorithm to find first and last k digits of >>>> n^n. >>>> >>>> -- >>>> >>>> You received this message because you are subscribed to the Google >>>> Groups "Algorithm Geeks" group. >>>> To post to this group, send email to algoge...@googlegroups.com. >>>> To unsubscribe from this group, send email to >>>> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> >>>> . >>>> For more options, visit this group at >>>> http://groups.google.com/group/algogeeks?hl=. >>>> >>>> >>>> >>> >>> >>> -- >>> <<Bharath>> >>> >>> >> >> >> -- >> <<Bharath>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algoge...@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> >> . >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=. >> > > > > -- > Regards, > Saurabh Aggarwal > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algoge...@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=. > -- Siddharth Prakash Singh http://www.spsneo.com -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@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=.