On Tue, Aug 13, 2013 at 9:45 AM, #PATHANGI JANARDHANAN JATINSHRAVAN# <
jatinshr...@e.ntu.edu.sg> wrote:

>  Hello All,
>
> Sorry for the earlier mail without subject. I was in a hurry so I missed
> that
>
>  I am solving problem number 5 in project euler. I think my solution
> seems logically correct but it is not giving an answer as it is taking too
> long to execute. So can someone suggest an alternative solution?
>

My approach: factor each number from 1 to 20 (for example, 20 factors to 1,
2, 2, 5) and build a list of factors; for each number, check to see that
the list contains enough copies of all of the current number's factors
(e.g. four 2s and two 3s) and add them to the list if not; at the end,
multiply the list of factors.

It took me about a minute in Excel; about 45 minutes to work out my
algorithm in Python - but it executed in less than a second.
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to