1. Factorial
The factorial of the number 9 is equal to: 362880
Its binary representation is: 1011000100110000000
This number has a total of 19 bits.
Please calculate, how many bits are there in the binary representation of the factorial of 9999?
Note: What needs to be submitted is an integer, do not fill in any irrelevant content (such as explanation, etc.)
The factorial of the number 9 is equal to: 362880
Its binary representation is: 1011000100110000000
This number has a total of 19 bits.
Please calculate, how many bits are there in the binary representation of the factorial of 9999?
Note: What needs to be submitted is an integer, do not fill in any irrelevant content (such as explanation, etc.)
Answer: 118445
Idea: Examine BigInteger
import java.util. *; import java.math.*; public class Main { public static void main(String[] args) { // write your code here BigInteger num; num=BigInteger.ONE; for(int i=1;i<=9999;i++) { BigInteger temp=BigInteger.valueOf(i); num=num.multiply(temp); } String str=num.toString(2); System.out.println(str.length()); } }