euler/euler020.rb

6 lines
100 B
Ruby
Raw Normal View History

2014-04-25 23:59:14 +00:00
def factorial(n)
(1..n).inject(:*)
end
puts factorial(100).to_s.split("").map(&:to_i).inject(:+)