与Project Euler的速度比较:C vs Python vs Erlang vs Haskell
问题: I have taken Problem #12 from Project Euler as a programming exercise and to compare my (surely not optimal) implementations in C, Python, Erlang and Haskell. 我将 Project Euler 中的 问题#12 作为编程练习并比较了我在C,Python,Erlang和Haskell中的(当然不是最优的)实现。 In order to get some higher execution times, I search for the first triangle number with more than 1000 divisors instead of 500 as stated in the original problem. 为了获得更高的执行时间,我搜索第一个三角形数字,其中有超过1000个除数而不是原始问题中所述的500。 The result is the following: 结果如下: C: C: lorenzo@enzo:~/erlang$ gcc -lm -o euler12.bin euler12.c lorenzo@enzo:~/erlang$ time ./euler12.bin