You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cwholt edited this page Jan 23, 2012
·
13 revisions
Write a program that computes the factorial of a given integer in the language of your choosing. Fastest implementation wins. I'll time each entry on my machine.
Your program should accept the integer as its sole argument.
For any interested ActionScripters, you can just submit the factorial function--I'll create a test harness and compile it with redtamarin.
It's worth noting that since each call to the program entails potentially loading an environment, this test reflects the quality of the program as a utility, and not the quickness of the function implementation itself.
Chul (C) -- 3.711580
Mark (C) -- 3.819705
Andres (C++) -- 3.826079
Drew (Haskell) -- 4.567761
cwh (Ruby) -- 5.198536
Andres (AS3) -- 16.034052
Will (AS3) -- 16.701006
Jason (Erlang) -- 127.315488
Ferose (Java) -- 190.650340
1000 iterations evaluating 120!
Chul, Mark, Will and Andres' programs could not correctly evaluate 120! and were therefore disqualified.
Drew (Haskell) -- 4.472966
cwh (Ruby) -- 5.144360
Jason (Erlang) -- 127.184300
Ferose (Java) -- 191.249031
Evaluating 100,000!
Jason's program did not correctly evaluate 100,000! and was therefore disqualified.