Hacker News new | ask | show | jobs
by jasamer 1376 days ago
There are efficient ways to compute x^n. Eg. you want to compute x^8. Instead of multiplying x eight times by itself, you can do ((x^2)^2)^2, which is just three multiplications.

To be fair, I’m not sure whether similar optimizations exist for computing the factorial, but I don’t think so.

1 comments

there aren't similar tricks for factorials.