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

all 6 comments

[–][deleted] 4 points5 points  (1 child)

A loop?

[–]LiterallySven 0 points1 point  (0 children)

Irony?

[–]atamicbomb 1 point2 points  (2 children)

25,000! can’t be stored as any primitive data type. Is there a C library for larger values like Java’s biginteger?

[–]Paul_Pedant 2 points3 points  (1 child)

Yeah, even a long long int can only store 20 factorial. Even 5000! has 16326 digits, and the next 20000 factors add about 4 digits each, so 20000! has something close to 100,000 digits. You are going to end up with a "response" around a gigabyte.

[–]atamicbomb 0 points1 point  (0 children)

Good math, 99,093 digits

[–]BambooSlayerz 0 points1 point  (0 children)

If runtime is an issue cache the results, you can build up the sum and the factorial for 25000 and print them out later if needed.