[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Counting bits from the other end



>From fwp-l Tue Jun 12 06:15:40 2001

Hi !
I was just searching for algorithms, to find out which bit of a number is set
with the least  amount of effort, when I came across your method of doing so
by
using the mod 19 technique for 18 bit numbers. Just reading through the
ensuing
communication, I found that the 37 is the smallest divisor for 32 bit numbers.
Is there a pattern here ?
Is it true that for an n bit number, the next highest prime number after n, is
what should be used in this algorithm ? We tried it for 64-bit numbers
(divisor
is 67), and 128-bit numbers (divisor is 131), and it seemed to work fine.
(Only
we don't know why :))

Virender/Kishore.

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe