1 ! Copyright (c) 2007 Aaron Schaefer.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: math math.functions sequences ;
6 ! http://projecteuler.net/index.php?section=problems&id=5
11 ! 2520 is the smallest number that can be divided by each of the numbers from 1
12 ! to 10 without any remainder.
14 ! What is the smallest number that is evenly divisible by all of the numbers from 1 to 20?
20 : euler005 ( -- answer )
21 20 1 [ 1+ lcm ] reduce ;
23 ! [ euler005 ] 100 ave-time
24 ! 0 ms ave run time - 0.14 SD (100 trials)