How to write a program to get the factorial of 4096.
I am working on a Linux m/c.
You will need a very large integer type to represent this. This
is commonly done with a "bignum" library as other posters have
mentioned.
For example: 4096! is the product of 4096 numbers:
2048 of them are multiples of 2.
1024 of them are multiples of 4.
512 of them are multiples of 8.
256 of them are multiples of 16.
128 of them are multiples of 32.
64 of them are multiples of 64.
32 of them are multiples of 128.
16 of them are multiples of 256.
8 of them are multiples of 512.
4 of them are multiples of 1024.
2 of them are multiples of 2048.
1 of them is 4096.
so there are 4095 low-order zero bits in the result. And that only
includes the factors of two in the result, ignoring all the other
stuff. You can do a similar analysis of how many factors of 5 there
are, to determine how many trailing decimal zeroes there are in the
result.