Linear time baseconversion

jonas.thornvall at gmail.com jonas.thornvall at gmail.com
Mon Jun 29 19:23:00 EDT 2015


Den tisdag 30 juni 2015 kl. 01:11:51 UTC+2 skrev Ian:
> On Mon, Jun 29, 2015 at 4:56 PM, Ian Kelly <ian.g.kelly at gmail.com> wrote:
> > On Mon, Jun 29, 2015 at 4:39 PM,  <jonas.thornvall at gmail.com> wrote:
> >> http://jt.node365.se/baseconversion8.html
> >
> > Back of the envelope mental calculation, that appears to be quadratic,
> > not linear. Doubling the length of the input results in an approximate
> > quadrupling of the time taken to produce the output.
> >
> > That noted, this is off-topic for this list, which is for discussion
> > about Python. Please take this to somewhere else like
> > comp.lang.javascript instead.
> 
> By the way, I think you have a bug. I did my time testing by
> concatenating the default input number to itself several times. At
> 5184 decimal digits, which was the last case I tried, the 58th output
> digit was 1111111, after which point the remaining 672 output digits
> are all 12665464, which seemed rather improbable.

No there is no bug, try 12665465^77 wolfram alpha gives
7976781785088446084873306945009387424538813088491673402748035781202063831184317457635773873975198429536727051788368983080016275695338973787545408588270715883570324803120051806974411884509607864124408509087974736382639726555779113221450078243163340395784592348080359062163885323462144257596380766496966084237358222613649636595300081207683175410584139478853066960795599027150403706812116411354218686846750615496852415389467898730884554700066802269059177874281189887271741594702334892800692129299635716260471508809448693000376806594431400299072265625

Try that number you get a ONE followed by 77 ZEROS



More information about the Python-list mailing list