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

Home > Just Math
Erase as much as needed (Posted on 2023-05-11) Difficulty: 3 of 5
Let

P=1*2*3*4* … *2022*2023

What is the lowest quantity of numbers out of the above 2023 that erasing them will cause the remaining result to be terminated by the digit 1 ?

See The Solution Submitted by Ady TZIDON    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution solution Comment 3 of 3 |
f=sym(1);
for i=sym(2):2023
  f=f*i;
end
f=char(f);
i=length(f); ct=0;
while f(i)=='0'
  ct=ct+1;
  i=i-1;
end
disp(ct)
disp(f(i-1:i));

finds that the last 503 digits of 2023 factorial are zeros and the last two digits before that are 1, 2.

Evan with all trailing zeros are removed, the remaining number must be odd and not a multiple of 5. So actually all even numbers must be removed and all multiples of 5 need to be removed. 

There are 1011 even numbers and 404 multiples of 5. As there are 202 even multiples of 5 (i.e., multiples of 10), there are 1011+404-202 = 1213 numbers removed altogether in order to remove the trailing zeros.

The product of the remaining 2023-1213 = 810 numbers is certainly a multiple of 3, as 3, 6, etc. are still factors. The last digits of these remaining numbers are in a cycle consising of 1. 3. 7. 9, 1, 3, 7, 9. This leads to the cycle of last digits of the product as being 1, 3, 1, 9, 9, 7, 9, 1. The 810 digit can be divided into 101 groups of eight plus two more, so the product ends in the second digit in the product cycle, 3.

This is a number that's a multiple of 3 and its last digit is 3. Therefore when it's divided by 3, its last digit will be 1. So the next step is to remove the 3 from the product so that it begins 1*4*7*9*11*13*17*19*21*23*27*29*...

That's 1213+1 = 1214 numbers to be removed from the multiplication to get a number ending in the digit 1.

prod=sym(1); factCt=0;
for i=1:2023
  if mod(i,2)~=0 && mod(i,5)~=0 && i~=3
    prod=prod*i;
    factCt=factCt+1;
  end
end
prod
factCt

produces what we have described and the result is

8881324580212617046210674151260597644307427066058318625635183113754921620283777294245671591894440379
2416247514994914779717172725654187158151937997512769065346120625996102958776749349021960628551750514
0433404784334323739442867435851968628719620212485111722043051377544793124382065113351399775263146557
3993813658094137308363808220899053887833374725882137689449302410299359546910309656432384971315681298
3582361763664336948680340903450153286331558181127753296321088644682991623192483795479014727949718358
1733354026963807098349982873212610451506240437474826268569539845429960737861462496695795188310411309
0726424486087951016464975978346720116551957865129836579723879158262785318306225760967326326628426371
6191564460178856545004095341444096446764946967551722392739979297261947417554694867022348166827854572
6630703388794684968131787786284047431790614312922357517927974932279999335959968045355041727711877610
7587972174243216478059605014436488291655579560664625528324627257499554308921056708046176283944494882
0675798595910301746334834527687856512557626756326703294545383848206130578653516962240537488645371880
8400203085752344193094121755285772192896659412802442115346784535019251795995574796690640279311207909
0716521921026905878357504987982025877642810173542516458957699767654677490795377690617519530291934570
0431673179921649926772657806297987104946250208245138886598262631113098636928856433543316398262666037
8002513925650255421956337299377705792265063276372612345590797009014027808922586712703217463708107737
7860264868063315094202836630318883041748916606426927328223197127577754349254722671977599683203145576
4322862439011919180520729009541468157639731762716486879363797315738099780057871230546204162014792446
2794823582690631862026218595906185125979733890728203234911418348391270065589072656980922793853880072
7763528495608560940460093221289795214914110834604556908168031116525538881705025752320277972982997081
2014474974615159716419163152254077542184338090755013163816743337775323385910002993501927855509674554
0982803428926103594208851407849881066371711312679830636013262459425252499184784127962888779978248485
9317635949008038371821918284892997332871999372272854845411214617707383704454821747559734995965560418
0053412778415072616867019848375506392864593165632059057512788044295734012443523941254377864585407518
97212071143601789852913081

which is the product of the 809 numbers used.


  Posted by Charlie on 2023-05-11 10:00:24
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