Done puzzle 42
[project-euler.git] / euler20.rb
1 class Integer
2 def factorial
3 Array.new(self) {|i| i + 1}.reduce(:*)
4 end
5 end
6
7 if __FILE__==$0
8 puts 100.factorial.to_s.scan(/./).map{|s| s.to_i}.reduce(:+)
9 end