All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Factorial zeros (Posted on 2011-02-17) Difficulty: 2 of 5
41! = 33452526613163807108170062053440751665152000000000
which is 50 digits long, the last 9 of them are 0s. Thus the trailing zeros make up 18% of the entire number.

Find n where n! has the largest possible proportion of trailing 0s.

Prove it.

No Solution Yet Submitted by Jer    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Exploration and an attempt at proof. | Comment 2 of 4 |
 n         digits in     trailing           proportion
               n!          zeros
 5             3             1             .3333333333333333
 6             3             1             .3333333333333333
 7             4             1             .25
 10            7             2             .2857142857142857
 11            8             2             .25
 


The above five values of n are the only ones under 1000 (and presumably the only five altogether) that have a proportion of at least 1/4. Both 5! and 6! have a proportion of 1/3, which seems to be the largest.

DECLARE FUNCTION lxf# (x#)
DECLARE FUNCTION log10# (x#)
DEFDBL A-Z

DIM SHARED loge10, twopi

loge10 = LOG(10)
twopi = 8 * ATN(1)

CLS
FOR n = 1 TO 1000
   alldigs = INT(lxf(n)) + 1
   n2 = n
   trailzeros = 0
   WHILE n2 >= 5
     q = n2 \ 5
     trailzeros = trailzeros + q
     n2 = q
   WEND
   IF trailzeros / alldigs >= .25 THEN
    PRINT n, alldigs, trailzeros, trailzeros / alldigs
   END IF
NEXT n

FUNCTION log10 (x)
  log10 = LOG(x) / loge10
END FUNCTION

FUNCTION lxf# (x#)
  IF x# < 171 THEN
    fact# = 1
    IF x# > 1 THEN
      FOR i = 2 TO x#
       fact# = fact# * i
      NEXT
    END IF
    lo# = log10#(fact#)
  ELSE
    lo# = log10#(x#) * (x# + .5#)
    lo# = lo# + (-x# + 1# / (12# * x#) - 1# / (360# * x# * x# * x#) + 1# / (1260# * x# * x# * x# * x# * x#)) / loge10#
    lo# = lo# + log10#(twopi#) / 2#
  END IF
  lxf# = lo#
END FUNCTION

While the proportion is not monotonically decreasing, it is the general trend:

 n         digits in     trailing           proportion
               n!          zeros
3             1             0             0
4             2             0             0
5             3             1             .3333333333333333
6             3             1             .3333333333333333
7             4             1             .25
8             5             1             .2
9             6             1             .1666666666666667
10            7             2             .2857142857142857
11            8             2             .25
12            9             2             .2222222222222222
13            10            2             .2
14            11            2             .1818181818181818
15            13            3             .2307692307692308
16            14            3             .2142857142857143
17            15            3             .2
18            16            3             .1875
19            18            3             .1666666666666667
20            19            4             .2105263157894737
21            20            4             .2
22            22            4             .1818181818181818
23            23            4             .1739130434782609
24            24            4             .1666666666666667
25            26            6             .2307692307692308
26            27            6             .2222222222222222
27            29            6             .2068965517241379
28            30            6             .2
29            31            6             .1935483870967742
30            33            7             .2121212121212121
31            34            7             .2058823529411765
32            36            7             .1944444444444444
33            37            7             .1891891891891892
34            39            7             .1794871794871795
35            41            8             .1951219512195122
36            42            8             .1904761904761905
37            44            8             .1818181818181818
38            45            8             .1777777777777778
39            47            8             .1702127659574468
40            48            9             .1875
41            50            9             .18
42            52            9             .1730769230769231
43            53            9             .169811320754717
44            55            9             .1636363636363636
45            57            10            .1754385964912281
46            58            10            .1724137931034483
47            60            10            .1666666666666667
48            62            10            .1612903225806452
49            63            10            .1587301587301587
50            65            12            .1846153846153846
10            7             2            0.28571429
100           158           24           0.15189873
1000          2568          249          0.09696262
10000         35660         2499         0.07007852
100000        456574        24999        0.05475345
1000000       5565709       249998       0.04491755
10000000      65657060      2499999      0.03807662
100000000     756570557     24999999     0.03304384
1000000000    8565705523    249999998    0.02918615

When n is between 100 and 1000, each successive number adds at least 2 to the total number of digits. Only every fifth number adds 1 to the number of zeros; only every 25th adds a second zero as well, and every 125th a third.

In successive decades, or orders of magnitude, similar numbers apply, with the "at-least" increment going up by one in each successive order of magnitude, but the increments of zeros going up by less and less each time (logarithmically, as base-5 logarithms, since the successive additions come only 1/5 as often).


  Posted by Charlie on 2011-02-17 20:39:20
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (9)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information