tag:blogger.com,1999:blog-3418265334198879901.post4903502960977866475..comments2023-06-10T14:12:41.433+05:30Comments on Coders Stop: Number of digitsAviralhttp://www.blogger.com/profile/11920144614598355124noreply@blogger.comBlogger11125tag:blogger.com,1999:blog-3418265334198879901.post-9412452243143536332011-01-23T22:54:08.047+05:302011-01-23T22:54:08.047+05:30also n = 0 XDalso n = 0 XDiamavalonhttps://www.blogger.com/profile/02470457922032008668noreply@blogger.comtag:blogger.com,1999:blog-3418265334198879901.post-80516976022049306692011-01-23T22:33:33.901+05:302011-01-23T22:33:33.901+05:30The only case where n! = 10^x for integers n and x...The only case where n! = 10^x for integers n and x is n=1.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3418265334198879901.post-51089368403401092452011-01-22T23:48:29.468+05:302011-01-22T23:48:29.468+05:30@swapnil .. consider a case where n! = 10^x ... in...@swapnil .. consider a case where n! = 10^x ... in that case<br />log(1) + log(2) ... log(n) = log(10^x) = x .. <br />but the correct answer is x+1<br />RegardsAviralhttps://www.blogger.com/profile/11920144614598355124noreply@blogger.comtag:blogger.com,1999:blog-3418265334198879901.post-88406091574120380262011-01-22T23:13:18.603+05:302011-01-22T23:13:18.603+05:30@aviral: if you are taking number of format 10^n (...@aviral: if you are taking number of format 10^n (n>1) as input, then also it won't fail...as I think so... :)Swapnilhttps://www.blogger.com/profile/17326584141209862564noreply@blogger.comtag:blogger.com,1999:blog-3418265334198879901.post-73436696065638165302011-01-22T21:21:29.287+05:302011-01-22T21:21:29.287+05:30@sachin ...
n! = 1*2*3*4....*n
log(n!) = log(1) +...@sachin ... <br />n! = 1*2*3*4....*n<br />log(n!) = log(1) + log(2) .... + log(n)<br />now log(n!) gives x which is 10^x = n!<br />Clearly x is the number of digits ... Rest corner cases u can work it out ... CheersAviralhttps://www.blogger.com/profile/11920144614598355124noreply@blogger.comtag:blogger.com,1999:blog-3418265334198879901.post-45874144658839886462011-01-22T21:08:05.389+05:302011-01-22T21:08:05.389+05:30can you please explain how did you get to this equ...can you please explain how did you get to this equation??Anonymoushttps://www.blogger.com/profile/16371845157380542348noreply@blogger.comtag:blogger.com,1999:blog-3418265334198879901.post-69573705092672597902011-01-22T20:55:46.229+05:302011-01-22T20:55:46.229+05:30actually it fails for any number of the form 10^n ...actually it fails for any number of the form 10^n .. u figured out for n=0 :) ...<br />Cheers...Aviralhttps://www.blogger.com/profile/11920144614598355124noreply@blogger.comtag:blogger.com,1999:blog-3418265334198879901.post-9133963863201729722011-01-22T16:47:03.047+05:302011-01-22T16:47:03.047+05:30okay I got it...fails for 1 :)okay I got it...fails for 1 :)Swapnilhttps://www.blogger.com/profile/17326584141209862564noreply@blogger.comtag:blogger.com,1999:blog-3418265334198879901.post-37618713665278943622011-01-22T16:42:42.582+05:302011-01-22T16:42:42.582+05:30This comment has been removed by the author.Swapnilhttps://www.blogger.com/profile/17326584141209862564noreply@blogger.comtag:blogger.com,1999:blog-3418265334198879901.post-28123129716351209222011-01-21T16:03:08.807+05:302011-01-21T16:03:08.807+05:30there is a small bug ...
number of digits = floor(...there is a small bug ...<br />number of digits = floor(log n + log n-1 + ... + log 2) + 1<br />u can reason it out why ....Aviralhttps://www.blogger.com/profile/11920144614598355124noreply@blogger.comtag:blogger.com,1999:blog-3418265334198879901.post-52460682430896467572011-01-21T14:47:27.229+05:302011-01-21T14:47:27.229+05:30number of digits = ceil(log n + log n-1 + ... + lo...number of digits = ceil(log n + log n-1 + ... + log 2)<br /><br />where log is base 10.Swapnilhttps://www.blogger.com/profile/17326584141209862564noreply@blogger.com