John Salerno <johnj...@gmail.com> writes:
> It's frustrating because I have the Python right, but I'm getting
> stuck on the math....
> "What is the smallest positive number that is evenly divisible by all
> of the numbers from 1 to 20?"

The answer is lcm [1,2,3, ... 20].  You can figure out how to implement
lcm.

The Euler problems are not really programming exercises.  They are
exercises in math and algorithms.  Quite a lot of them involve thinking
clever and fast ways to do stuff that would be trivial (but too slow) by
brute force.  In general, once you figure out the right algorithm,
writing the code is easy.  But you have to be fairly mathematically
attuned, to have any chance of spotting the algorithm.

If you want programming exercises that are less mathematical, there are
some nice ones at rubyquiz.com.  They are intended for Ruby but of
course you can solve them in Python.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to