Best search algorithm to find condition within a range

Chris Angelico rosuav at gmail.com
Wed Apr 8 03:49:34 CEST 2015


On Wed, Apr 8, 2015 at 8:57 AM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> On Tue, 7 Apr 2015 07:44 pm, jonas.thornvall at gmail.com wrote:
>
>
>> I want todo faster baseconversion for very big bases like base 1 000 000,
>> so instead of adding up digits i search it.
>
> What digits would you use for base one-million?
>
> Base 2 uses 0 1.
> Base 3 uses 0 1 2.
> Base 10 uses 0 1 2 3 4 5 6 7 8 9.
> Base 16 uses 0 1 2 3 4 5 6 7 8 9 A B C D E F.
>
> Base one million uses what?
>
> How would you write down 12345 in base one-million?

You could use base 1,114,112 fairly readily in any decent modern
programming language. That'll happily represent base one-million.

ChrisA



More information about the Python-list mailing list