zeroed out
Avi Gross
avigross at verizon.net
Wed Dec 12 00:46:03 EST 2018
Joe,
All numbers start with zero, and even an infinite number of them! LOL!
All kidding aside, I note that some data that is stored in a fixed width has zeroes padding it all the way to the right. If you store the number 3 in binary as a byte, it tends to look like 00000011. Depending on how integers are stored, something similar can happen for longer stretches. But with decimals, we tend to not bother showing the empty areas that represent 0 times ever higher powers of 10.
But on the right, zeroes are required as otherwise you have no idea what the other numerals mean. 5900 is not 59. Yes, you can write 59e2 or 5.9e3. Yet on the other side of the decimal point, it is reversed. You need 0's on the left but on the right only if you want to show significance.
But there are limits. Most programs do not support indefinite precision arithmetic. Too many digits including zeroies tend to be ignored.
Python integers though, see boundless:
>>> 2**80
1208925819614629174706176
>>> _**10
6668014432879854274079851790721257797144758322315908160396257811764037237817632071521432200871554290742929910593433240445888801654119365080363356052330830046095157579514014558463078285911814024728965016135886601981690748037476461291163877376
>>> _**10
173766203193809456599982445949435627061939786100117250547173286503262376022458008465094333630120854338003194362163007597987225472483598640843335685441710193966274131338557192586399006789292714554767500194796127964596906605976605873665859580600161998556511368530960400907199253450604168622770350228527124626728538626805418833470107651091641919900725415994689920112219170907023561354484047025713734651608777544579846111001059482132180956689444108315785401642188044178788629853592228467331730519810763559577944882016286493908631503101121166109571682295769470379514531105239965209245314082665518579335511291525230373316486697786532335206274149240813489201828773854353041855598709390675430960381072270432383913542702130202430186637321862331068861776780211082856984506050024895394320139435868484643843368002496089956046419964019877586845530207748994394501505588146979082629871366088121763790555364513243984244004147636040219136443410377798011608722717131323621700159335786445601947601694025107888293017058178562647175461026384343438874861406516767158373279032321096262126551620255666605185789463207944391905756886829667520553014724372245300878786091700563444079107099009003380230356461989260377273986023281444076082783406824471703499844642915587790146384758051663547775336021829171033411043796977042190519657861762804226147480755555085278062866268677842432851421790544407006581148631979148571299417963950579210719961422405768071335213324842709316205032078384168750091017964584060285240107161561019930505687950233196051962261970932008838279760834318101044311710769457048672103958655016388894770892065267451228938951370237422841366052736174160431593023473217066764172949768821843606479073866252864377064398085101223216558344281956767163876579889759124956035672317578122141070933058555310274598884089982879647974020264495921703064439532898207943134374576254840272047075633856749514044298135927611328433323640657533550512376900773273703275329924651465759145114579174356770593439987135755889403613364529029604049868233807295134382284730745937309910703657676103447124097631074153287120040247837143656624045055614076111832245239612708339272798262887437416818440064925049838443370805645609424314780108030016683461562597569371539974003402697903023830108053034645133078208043917492087248958344081026378788915528519967248989338592027124423914083391771884524464968645052058218151010508471258285907685355807229880747677634789376
-----Original Message-----
From: Python-list <python-list-bounces+avigross=verizon.net at python.org> On Behalf Of Joe Pfeiffer
Sent: Wednesday, December 12, 2018 12:04 AM
To: python-list at python.org
Subject: Re: 03 digression by brute force
"Avi Gross" <avigross at verizon.net> writes:
> SYNOPSIS: One way to solve math puzzle by brute force. (message sent
> earlier disappeared)
>
>
>
> Quick note. Jack started by asking why python does not like decimal
> numbers with leading zeroes. When asked to explain, he said he was
> trying to solve word problems using python. Someone mentioned problems
> like solving SEND + MORE = MONEY and I decided to quickly write a
> function that would solve anything of that sort that only has addition
> on either side of the equals.
>
>
>
> What amused me was that I had 25 solutions to the above when I was
> told there would be one. Closer examination showed that 24 of those
> had the ‘M’ in MONEY set to zero which the logicians claimed was not a
> sensible solution.
What amuses me is the solution to the problem that started the whole thread had at least one number with a leading 0.
--
https://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list