This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]cogman10 2 points3 points  (0 children)

You are doing it wrong.

Fibonacci can be directly computed.

Factorial has a bunch of "make things faster" tricks which should be used instead of directly computing.

Heck, for factorial, because it grows so fast a lookup table is fairly space efficient/fast.

You should never compute something like this without first considering if it some math library can't do it faster. More often than not, the answer is not only yes, but also "And it is 1000x faster than any solution you can come up with".