repo.or.cz
/
ruby-svn.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
history
|
raw
|
HEAD
* string.c (rb_str_splice_0): call rb_str_drop_bytes, not rb_str_drop.
[ruby-svn.git]
/
benchmark
/
bm_app_answer.rb
blob
3cd8a8fd37b2bcaa3a58f6f9e01c2ecb034ee532
1
def ack(m, n)
2
if m == 0 then
3
n + 1
4
elsif n == 0 then
5
ack(m - 1, 1)
6
else
7
ack(m - 1, ack(m, n - 1))
8
end
9
end
10
11
def the_answer_to_life_the_universe_and_everything
12
(ack(3,7).to_s.split(//).inject(0){|s,x| s+x.to_i}.to_s + "2" ).to_i
13
end
14
15
answer = the_answer_to_life_the_universe_and_everything