Dear All,

I've been trying to do the problem written at
http://projecteuler.net/index.php?section=problems&id=5 . The problem
is to find the smallest positive number divisible by all of the
numbers from 1 to 20. My solution is as follows:

$:@>:^:(+./@:(0&~:@((1 + i. 20)&|))) 1

On the page, it says that the smallest number divisible by all of the
numbers up to 10 is 2520, which my solution rightly finds when one
substitutes the 20 for 10. When running it with 20, I get a stack
error. Could anyone tell me how to get around this with my current
solution? How about some smarter solutions?

Justin
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to