Post Reply 
(49g 50g) Number of Trailing Zeros in N!
06-03-2022, 03:19 PM
Post: #4
RE: (49g 50g) Number of Trailing Zeros in N!
In the same chapter Martin Gardner talks about printing a factorial as a tree.

This Python program produces one of the examples:
Code:
from math import factorial

p = str(factorial(508))

n = 0
for j in range(34):
    k = 2*j + 1
    print(" " * (35 - j), p[n:n+k])
    n += k

                                  5
                                 119
                                90692
                               7755879
                              266003615
                             25819185379
                            7984360677298
                           470133958906714
                          46011174633964398
                         5839112233165772956
                        548496166254935516795
                       14565079522588677608012
                      6423489045662147453126349
                     825790036437158643266482002
                    88113505694916924243929121639
                   7995123320680205388149829536720
                  697546589338105120020005674705145
                 28641409978978956631664608452253922
                2182139322091260889711710217500934598
               659546487929459214735007200769105667735
              54074289548655659977226200540160335058131
             8365384235510714071491098835812736588922795
            511456461421254773804907853073384484888784090
           75030962875912509521999525292598359880846423952
          3931204111818280979213544777644751538435208774603
         088477116032223651164439419220002073567325180151958
        35354728897604905269289015307797618984464654042934912
       7882733479825616955531216107050271401259459875249508169
      440013327395316887000833911764483284987619075088343797786
     47371945157918046252226969546616811434035461815792968273198
    2545625613705049834238544557702694536385292145346080336071424
   289160111720849018903249047529128422886467764267877861568498090
  42964480000000000000000000000000000000000000000000000000000000000
 0000000000000000000000000000000000000000000000000000000000000000000

Also he mentions:
Quote:If someone had predicted fifty years ago that before the century
ended this factorial would be written out in full, digit by digit,
most mathematicians would have laughed at so preposterous a
prophecy.

And now, another 50 years later, we can do this with our smartphones.


Mathematical Magic Show
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: (49g 50g) Number of Trailing Zeros in N! - Thomas Klemm - 06-03-2022 03:19 PM



User(s) browsing this thread: 1 Guest(s)