Best search algorithm to find condition within a range
bc at freeuk.com
Thu Apr 9 11:19:21 CEST 2015
On 08/04/2015 23:06, Marko Rauhamaa wrote:
> BartC <bc at freeuk.com>:
>> So the the number 3,012,345, in base 1000000, could represented in
>> text form as the two 'digit':
>> (3, 12345)
>> ie. 3*1000000 + 12345*1. In internal binary, each digit can just be
>> stored in the normal form, probably as one digit per 32-bit integer.
>> (I have a big integer library that works exactly this way, using a
>> decimal representation, but using base 1000000 with digits 0 to
>> 999999, rather than base 10 and digits 0 to 9.)
> It is common to implement big integers in base-2**16, base-2**32 or
This was a development of a version that used base-10 strings to encode
It might be a magnitude slower than, say, built-in Python big integers,
but a huge advantage had been in being able to print out the results
easily without needing division.
(I know that there is some algorithm to print an arbitrary precision
binary number using shifts and masks, but I didn't know it then.)
> Arithmetics is performed just like in elementary school.
Not in the school I went to; we used decimal!
More information about the Python-list