The thought which comes to my mind is Modular exponentiation :<br>for a ** b % r ( if a ** b very large )<br><br>I had coded it in C++ but in python the pow() have inbuilt modular-function made.<br>so pow(a ,b, r) does the trick<br>
<br>Here for factorial :<br>F(n) = n * n-1 * n-2 ...* 2 * 1<br>Just like in earlier case where we needed to do was,<br>a * a * a ..(b times) % r, modulation at each step help reduce computation since what we need is F(n) % 10**5<br>
<br>The key point i think is we do not need factorial but modulus 10**5 without trailing zeros. Didn&#39;t helped though :( may be a better implementation could help<br><br><br><br><div class="gmail_quote">On Mon, Sep 14, 2009 at 6:51 PM, Navin Kabra <span dir="ltr">&lt;<a href="mailto:navin.kabra@gmail.com">navin.kabra@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
 print f(1000000000000)<br><br></blockquote><div><br>This is a HUGE number. I don&#39;t think you are expected to get the answer by direct calculation. I would guess that you are expected to use mathematical reasoning to figure out the answer (and not computation)<br>


 <br></div></div>
<br>_______________________________________________<br>
BangPypers mailing list<br>
<a href="mailto:BangPypers@python.org">BangPypers@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/bangpypers" target="_blank">http://mail.python.org/mailman/listinfo/bangpypers</a><br>
<br></blockquote></div><br>