There is only one prime
p such that
p! is
p digits long.
Find it and prove its uniqueness.
prime length of factorial
factorial
2 1 2
3 1 6
5 3 120
7 4 5040
11 8 39916800
13 10 6227020800
17 15 355687428096000
19 18 121645100408832000
23 23 25852016738884976640000
29 31 8841761993739701954543616000000
31 34 8222838654177922817725562880000000
37 44 13763753091226345046315979581580902400000000
41 50 33452526613163807108170062053440751665152000000000
43 53
47 60
53 70
59 81
61 84
67 95
71 102
73 106
79 117
83 125
89 137
97 152
101 160
The only match on the table is for p=23, which has a 23-digit factorial.
After 100, each successive factorial's length goes up by at least 2 for every increase of the number by 1, so no numbers, prime or not, beyond 100 will have a factorial whose length matches the number.
More fundamentally, now that I think about it, even after 29, each successive number's factorial's length increased by at least 1, and the factorial's length was already greater than the number itself -- no need to go all the way to over 100.
In fact, only 1, 22, 23 and 24 have the property that each one's factorial's length is equal to the number itself. Of these, only 23 is prime.
Table generated by:
5 open "1andonly.txt" for output as #2
10 repeat
20 P=nxtprm(P)
30 Pf=!(P)
40 Ps$=cutspc(str(Pf))
50 L=len(Ps$)
60 print #2,P,L
70 until P>100
80 close #2
supplemented by a variation also printing Pf, the actual factorial.
|
Posted by Charlie
on 2016-04-28 10:34:13 |