projects
/
project-euler.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
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