# Calculate (9^9)! and retrieve specific 5 digits from result?

Posted 4 months ago
646 Views
|
3 Replies
|
0 Total Likes
|
 Hi, to solve a puzzle I shall calculate the big number (9^9)!. Now I need to retrieve the 5 numbers at the digits 97550930-97550925 (to the right). Which term do I need to enter in WolframAlpha in oder to solve this and do I need to have another plan then the basic plan to do so? Thx for help.
3 Replies
Sort By:
Posted 4 months ago
 Not an answer to your question, but worth checking if that range is in the number of trailing zeros in the factorial of the number. That is given by the sum of the floor of the number divided by each power of 5. factorialTrailingZeros[n_] := NestWhileList[Floor[#/5] &, n, # > 0 &] // Rest // Total factorialTrailingZeros[9^9] (* 96855113 *) That is smaller than the range 97550930 - 97550925, so they are not all zeros.
 I think the answer is: {7, 9, 3, 7, 8, 7} num=(9^9)!; (* compute the huge number: 3 billion digits *) IntegerLength[num]-97550930 (* how many digits can we cut away on the right? *) num2=Quotient[num,10^3000000000]; (* cut away 3 billion digits on the right*) id=IntegerDigits[num2]; (* get the digits *) Take[id,{97550925,97550930}] (* get the digits, counting from the left *)