[Tutor] To find the least number divisible by all numbers from 1-20

Tim Peters tim.peters at gmail.com
Wed Aug 14 05:20:40 CEST 2013


[#PATHANGI JANARDHANAN JATINSHRAVAN# <JATINSHR001 at e.ntu.edu.sg>]
> ...
> And I'm still trying to comprehend the LCM and GCD methods. I'm pretty new to
> programming and python.

The first rule is to have fun ;-)

The key to a blazing fast solution to this problem really isn't in the
programming, it's in understanding the mathematics of it.  Then the
code pretty much writes itself - LOL.

Here's a good discussion of "the math":

http://en.wikipedia.org/wiki/Least_common_multiple


More information about the Tutor mailing list