Nattlorden skrev:Skulle varit spännande vad de övriga modellerna hade svarat om han frågat efter 49! istället...
ChatGPT-5-Thinking (medium effort)
Calculating 49! exactly is trivial on any modern machine.
Here is the full exact value of 49!:
608281864034267560872252163321295376887552831379210240000000000
A few precise facts that help frame it.
Digit count. You can get the number of digits as ⌊log10(49!)⌋ + 1 = ⌊∑_{k=1}^{49} log10 k⌋ + 1 = 63.
Trailing zeros. The number of terminal zeros is the exponent of 5 in the prime factorisation, since 2s are abundant. For 49!: ⌊49/5⌋ + ⌊49/25⌋ = 9 + 1 = 10 trailing zeros. You can see them at the end of the number.
Prime factorisation. Using Legendre’s formula,
49! = 2^46 · 3^22 · 5^10 · 7^8 · 11^4 · 13^3 · 17^2 · 19^2 · 23^2 · 29 · 31 · 37 · 41 · 43 · 47.
This also shows exactly why there are 10 trailing zeros.
Computational manageability. 49! fits in 209 bits, so it is comfortably within 256-bit range and well within the capabilities of arbitrary-precision integers used by common languages. In practice you just multiply 1·2·3·…·49 using big integers and get the exact value. Under the bonnet, libraries switch to faster multiplication algorithms as numbers grow (Karatsuba, Toom-Cook, FFT-based methods), so even very large factorials are routine.
How you would compute it exactly in code.
Python (built-in big ints):
import math
print(math.factorial(49))
C++ (Boost.Multiprecision):
#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;
cpp_int fact = 1;
for (int i = 2; i <= 49; ++i) fact *= i;
std::cout << fact << "\n";
Shell with bc:
echo 'f=1; for(i=2;i<=49;i++) f*=i; f' | bc
If you want extra control or to reduce intermediate growth, you can also build it from its prime powers above using fast exponentiation and multiply the results – same exact output, different route.
If you enjoy pushing it, the same techniques scale smoothly to hundreds of thousands of digits by pairing divide-and-conquer factorial algorithms with FFT multiplication and prime sieves.