Best search algorithm to find condition within a range

jonas.thornvall at gmail.com jonas.thornvall at gmail.com
Wed Apr 8 02:19:49 EDT 2015


Den onsdag 8 april 2015 kl. 02:38:57 UTC+2 skrev Steven D'Aprano:
> On Wed, 8 Apr 2015 03:44 am, Ian Kelly wrote:
> 
> >>>>
> to_base(2932903594368438384328325832983294832483258958495845849584958458435439543858588435856958650865490,
> >>>> 429496729)
> > [27626525, 286159541, 134919277, 305018215, 329341598, 48181777,
> > 79384857, 112868646, 221068759, 70871527, 416507001, 31]
> 
> 
> They're not exactly *digits* though, are they? Without an easy to use set of
> 429496729 different symbols, the whole exercise is rather pointless. It's
> not more compact: 97 decimal digits, versus 121 characters in the list
> representation. 110 if you strip out the spaces between items. It's
> certainly not more memory efficient: the long int 293...490 takes 56 bytes,
> compared to 80 bytes for just the list, not including the memory used by
> its 12 int items. (Results may vary in other versions of Python.) You can't
> do arithmetic on it faster than Python's built-ins.
> 
> Besides, it isn't clear to me whether Jonas wants to convert decimal
> 293...490 *into* base 429496729 as you have done, or *base 429496729*
> 293...490 into decimal.
> 
> 
> 
> -- 
> Steven

Well Steven you just draw a line under connecting them all, and now you are allowed to call whatever combination you write down a single digit.

And you have just created 429496729 unique symbols ;), in a pencil stroke.
I know at least one intergalactic poster that will be impressed ;)



More information about the Python-list mailing list