A Groovier Way to Find the sum of digits in 100! (Factorial)
A Groovier way to write http://snipplr.com/view/10565/find-the-sum-of-digits-in-100-factorial/
Copy this code and paste it in your HTML
(ONE..
n).
inject(ONE
) { result, number
-> result
*number
} }
n.
toString().
collect { it.
toBigInteger() }.
sum()}
Report this snippet
Comments
Subscribe to comments