[plt-scheme] Re: Unreasonably slow
rf schrieb:
> This is a bit late, but the solution to "What is the smallest number
> that is evenly divisible by all of the numbers from 1 to 20"
> is much simpler:
> (require (planet "math.ss" ("soegaard" "math.plt" 1 3)))
> (apply lcm (interval 1 20))
Hello,
although (planet soegaard/math:1) is a very nice and useful library, I
see no need to load extension modules for built-in functionality:
(apply lcm (build-list 20 add1))
lcm is part of R5RS and loading the math library to construct a list of
integers is clearly overkill.
However, solving the problems by throwing some library functionality at
them is maybe not the intention of Project Euler ;-)
cu,
Thomas