M/N is the product of all the integers from 1010 through 2018 inclusive. That's 1009 integers being multiplied.
As there are more even numbers and other powers of 2 than powers of 5, the presence of 5 as a factor in the product is the limiting number sought. The number of times 5 appears as a factor in the product is the number of trailing zeros.
The first few powers of 5 are:
5
25
125
625
3125
15625
1009/5 = 201 with remainder 4; so far: 202 as a multiple of 5 occurs within the "remainder" no matter which end you consider as being the remainder.
1009/25 = 40 with remainder 9; another 40 as a multiple of 25 does not occur within the "remainder".
1009/125 = 8 with remainder 9; another 8
1009/625 = 1 with remainder 384; add in 2, as a multiple of 625 does occur within the "remainder". The two are 1250 and 1875.
So add 'em up: 202+40+8+2 = 252 trailing zeros.
A check:
bf1$=BigFact$(2018)
bf2$=BigFact$(1009)
ans$=BigDiv$(bf1$,bf2$,5000)
open 2,"trailing zeros.txt","w"
writeln 2,ans$
Writeln 2," "
a$=ans$
do
if len(a$)>100 then
Writeln 2,left$(a$,100)
a$=mid$(a$,101)
else
Writeln 2,a$
a$=""
Endif
loop until len(a$)=0
close 2
print ans$
print len(ans$)
i=len(ans$)
do
i=i-1
loop until mid$(ans$,i,1)<>"0"
print i
finds the quotient has 3201 digits; the last non-zero digit occurs at the 2949th position.
2249483470254618793146568878523059738419104216708286338140495265867841665266644649469838759370150595
2666837398682463531426522744442725760046424072366164556550788836187439077072346300761330933211883971
9924782303069407468591493419183199743769051243270110964017112529255653921258626426737409630815954874
3708955879586621838763810511604084110466733602032151839785592755651632613978517754825870999738189562
0457217463264426690478056117483319701483284765165699910637048380928830837961955456341940592180780596
6230203923226319545963135616121710703468809757884919446347361672109620938881614809226726534403961087
8864546519989652455961811857348394281234573586539980083203096556644263215016309556322408780127964303
7898584392037541218379677880318081381229605261786703798085834560838336293907709131282966348733083827
1396658245157835050781437348166298167126156805057425192911753778401549966972731728676045204071868009
8727142355629026599182512807074377148048617039453917609301954698566203568584693858575835464338249500
3433662112755378084397960861916336583723122505731044451225905853927123983160691439309364703138591683
4047482778055145313778905072801563911017255075977071893289002151314010726390443362316115433764200641
3440856930613478237223351807727975074580896447877641992761696968813609155721018221680054590844714574
8961233008415186848715649664848585201249397691645696011322490470258410681425418745294411910429767860
7782713417980282102060172713194655457602182723783680963264605639161175467644372066729831950756024723
7037029752828118623516023165828010472378614853087092437111281359202016800400535502591707175832795349
1184446814238785718340935308006574391596880846666755527766753900430377538489089552579332859842999509
8267113576551839441295127592066876665412703666093063925196150544885654869560845761435669139646376464
1798017764141697881344449346962474562967415067684772728929725797445001493757213490588930139338809838
8285374456858364397677788495980161548612264406640006586531469775983010508617779939750766839892611869
1717441851749948397847806117306474886699598785079444424702579628209222243019344054170952878690284845
1077745597893862506040024773352085874147860797798453357581179069324160671399347231313927261082668266
6586193495438056247502929762819300608114081407856457881435243491478618275599721471108815236830270557
5536985746006462277802197389893742640606513999018845353736190466744125720861699473882442238974388531
6981556851756416668149444878880627761066215945526051465641006671863133980269816880705223987493154336
6323871896356250162254372810597023266298910444384398329581509113813152722949479936459630704123142966
0847922953721469864157196981232459944696782429240125083190958623284012418377005353725725345377396353
7207216841758684837475820284693097231354766971418136378775178626989279159039612771740552308516751689
7682296339537671115130522904955251734102551558954996992547422588789268510680745259980816432568278362
2779992593275834507897886220253369898128673603584000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0
|
Posted by Charlie
on 2018-02-28 10:35:55 |