From: Henry Baker
Subject: Q: name of fcn to count low-order zeros in bin. # ??
Date: 
Message-ID: <hbaker-3101970800040001@10.0.2.1>
I'm gathering a list of the _names_ used for the library function which
counts the number of low-order zeros in the binary representation of
an integer = the exponent of the largest power of 2 that divides the
integer.

For the moment, let us call this function 'foo(n)'.  Then

foo(1) = 0
foo(2) = 1
foo(3) = 0
foo(4) = 2
foo(5) = 0
foo(6) = 1
foo(m 2^k) = k if odd(m)
etc.

Note that 2^(foo(n)) = n AND (-n).

I know that the 'foo(n)' exists in every large symbolic and number theory
package under various different names.  What I am interested in is _what these
names are_.  Perhaps it is time to standardize on such a name.

---

In Common Lisp, there is a function 'integer-length', which is an approximation
to log2(n), but nothing corresponding to foo(n).

In Common Lisp, we can define

(defun foo (n) (- (integer-length (logand n (- n))) 1))

but this isn't an efficient method for calculating foo(n) for large
n, because it costs a lot to compute even when n is odd, and hence
foo(n) is trivially 0.

---

Thanks for your responses in advance.