WC '95 P5 - Factorial Power

View as PDF

Submit solution

Points: 5
Time limit: 1.0s
Memory limit: 16M

Problem types
Allowed languages
Assembly, Brain****, C, C++, COBOL, Forth, Fortran, Java, Lua, Prolog, Text, Turing
Woburn Challenge 1995

The factorial of a whole number NN (written as N!N!) is defined as follows:

\displaystyle N! = 1 \times 2 \times \dots \times (N-1) \times N\displaystyle N! = 1 \times 2 \times \dots \times (N-1) \times N

For example, 10! = 1 \times 2 \times 3 \times 4 \times 5 \times 6 \times 7 \times 8 \times 9 \times 10 = 3\,628\,80010! = 1 \times 2 \times 3 \times 4 \times 5 \times 6 \times 7 \times 8 \times 9 \times 10 = 3\,628\,800.
The "factorial length" of a number NN is defined as the number of digits in N!N!. Thus the factorial length of 1010 is 77.

Input Specification

On each of five lines is a positive integer NN in the range 1 \dots 5001 \dots 500.

Output Specification

For each of the five inputs, output that number's factorial length in the format shown below.

Sample Input

1
2
5
10
52

Sample Output

The length of 1! is 1
The length of 2! is 1
The length of 5! is 3
The length of 10! is 7
The length of 52! is 68

Comments

There are no comments at the moment.