@Mark,<br><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">
The str(...).split('.') here doesn't do a good job of extracting the<br></div>
integer part when its argument is >= 1e12, since Python produces a<br>
result in scientific notation. I think you're going to get strange<br>
results when k >= 13.<br></blockquote><div><br>Yeah, you were correct. I tested it for k >= 13, and there were issues i.e. only one character is printed.<br>Shashwat-Anands-MacBook-Pro:Desktop l0nwlf$ python CALCULAT.py <br>
3<br>1000000 12 12<br>826393051664 000000000000<br>1000000 13 13<br>8 0000000000000 <br>100 15 4<br>9 0000<br><br>The logic I tried was : for <br>alpha = n!<br>log(alpha) = log(n!)<br> = log(n) + log(n-1) + .. log(2) + log(1)<br>
= e [where e = log(n) + .... + log(1)]<br><br>frac_e = {e} (fractional part of e, like {1.23} = .23)<br>now last k digits of alpha = 10**frac_e * 10**(k - 1)<br><br>As I can see, the method is mathematically sound, and there is precision issues. Time for code modification.<br>
<br>~l0nwlf<br></div></div>