Terry Reedy <tjre...@udel.edu> writes:

> On 2/18/2013 2:13 PM, John Immarino wrote:
>> I coded a Python solution for Problem #14 on the Project Euler
>> website. I was very surprised to find that it took 107 sec. to run
>> even though it's a pretty simple program.  I also coded an equivalent
>> solution for the problem in the old MSDOS basic. (That's the 16 bit
>> app of 1980s vintage.)  It ran in 56 sec. Is there a flaw in my
>> coding, or is Python really this slow in this particular application.
>> MSDOS Basic usually runs at a snails pace compared to Python.
>
> I find this surprising too. I am also surprised that it even works,
> given that the highest intermediate value is about 57 billion and I do
> not remember that Basic had infinite precision ints.

That may explain why the Basic version is faster: it gets overflow and
then it may have taken some shortcuts.
-- 
Piet van Oostrum <p...@vanoostrum.org>
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to