euler p2 solved by groovy by using Closure and generator pattern.