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

Home > Numbers
Removing Zeros to Reveal the Tail of a Product (Posted on 2024-10-26) Difficulty: 3 of 5
Let M be the product 101*102*103*...*505. Bob writes M on a chalkboard, then erases all occurrences of the digit zero to obtain a new number N. Find the last three digits on N.

No Solution Yet Submitted by Danish Ahmed Khan    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Computer solution Comment 1 of 1
Actually in python integer size is only constrained by available memory, so integer calculations this large are straightforward.

With zeros: (990 digits)
420955533806721795029895350947797314557890620777248126738186
735856056002380165070515165634233427739571781653528189200237
194796542324675196739961490862703596750438525839307102018005
096225988845647714300278905928948170722311800590982997123687
435159334650179464590941489858191820954399922465561663263747
054969991176226930618469250558831369543697939161665146697555
097220934685079270083023632337726949487550806187329698109315
667107760154600524450173111987163614616084595013805247939499
483023209433644234082553233301742271328578689019449537188769
886657284009162662976773922392304235720729444948010177300026
231268396203095768424022866523418527420035031426837676335339
712165591120277803788849889244783370853507522347553907896201
877748908383596158398679452835738065142312672328770442151450
327262603433112988033866309871583174540224459837356889474152
775637802506542700000593233288458359160314213171200000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000

Without zeros: (794 digits)
429555338672179529895359477973145578962777248126738186735856
562381657515165634233427739571781653528189223719479654232467
519673996149862735967543852583937121859622598884564771432789
592894817722311859982997123687435159334651794645994148985819
182954399922465561663263747549699911762269361846925558831369
543697939161665146697555972293468579278323632337726949487558
618732969819315667177615465244517311198716361461684595138524
793949948323294336442348255323331742271328578689194495371887
698866572849162662976773922392342357272944494811773262312683
962395768424228665234185274235314268376763353397121655911227
783788849889244783378535752234755397896218777489838359615839
867945283573865142312672328774421514532726263433112988338663
987158317454224459837356889474152775637825654275932332884583
59163142131712

-------------
prod = 1
for n in range(101,506):
    prod *= n
print(prod)

strprod = str(prod)
smaller = int(strprod.replace('0', ''))
print(smaller)

  Posted by Larry on 2024-10-26 09:03:27
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 (5)
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