RE: Smarter algo, was Re: 03 digression by brute force

2018-12-16 Thread Avi Gross
--Original Message- From: Python-list On Behalf Of BlindAnagram Sent: Saturday, December 15, 2018 7:41 AM To: python-list@python.org Subject: Re: Smarter algo, was Re: 03 digression by brute force <<>> There are quite a few Python based solvers for alphametics around on the net,

Re: Smarter algo, was Re: 03 digression by brute force

2018-12-16 Thread jfong
is is much faster. > >> > >> Range() is probably a highly efficient built-in written in C, but it can > >> totally be eliminated in this code as it is a constant. You can write > >> {1,2,2,3,4,5,6,7,8,9} or [0,1] instead of calculating ranges. > >> > >>

Re: Smarter algo, was Re: 03 digression by brute force

2018-12-15 Thread BlindAnagram
, but it can >> totally be eliminated in this code as it is a constant. You can write >> {1,2,2,3,4,5,6,7,8,9} or [0,1] instead of calculating ranges. >> >> Naturally, this code does not scale up to finding the two solutions for: >> >> HAWAII + IDAHO +IOWA + OHIO = S

Re: Smarter algo, was Re: 03 digression by brute force

2018-12-15 Thread jfong
> all entries in it as characters, right justified. You can then work on any > number of columns by extracting columns backwards from the right and applying > whatever logic, perhaps recursively. The possible carry amounts need to be > estimated as no more than about the number

RE: Smarter algo, was Re: 03 digression by brute force

2018-12-14 Thread Avi Gross
s being added minus one. But, I am ready to do other things so I leave it as an exercise for the reader 😉 -Original Message- From: Python-list On Behalf Of Peter Otten Sent: Friday, December 14, 2018 3:21 AM To: python-list@python.org Subject: Smarter algo, was Re: 03 digression by b

Smarter algo, was Re: 03 digression by brute force

2018-12-14 Thread Peter Otten
jf...@ms4.hinet.net wrote: > Just for fun:-) On my ooold PC, it takes 0.047 seconds to run the > following algorithm on the problem 'SNED + MORE == MONEY". > def tenThousand(u, Cin): # Cin == M > global n > if Cin == M: > print(S, E, N, D, '+', M, O, R, E, '==', M, O, N, E, Y) >