logoalt Hacker News

pagadeyesterday at 2:30 PM2 repliesview on HN

Reminds me of: Professor asked us to find the biggest factorial using C programming language. And then using LISP. You can imagine our surprise.


Replies

pkayeyesterday at 3:42 PM

There is a algorithm call Prime Swing Factorial that can compute large factorials exactly in arbitrary precision math using prime factorization. Like 10000000! in under second depending of how optimized the math library it. Probably like 100x faster than the normal method.

show 2 replies
smcinyesterday at 10:14 PM

I think you mean "using base C without any arbitrary-precision library (e.g. GMP)" . All that illustrates is that Lisp has built-in support for arbitrary-precision arithmetic, whereas C doesn't. Otherwise, how is this surprising, and what is the reason for the performance difference?