> Hm, I can imagine that counting ones may not be the fastest way to determine 
> the valuation of an integer. If i is very large and odd, for instance, the 
> above solution seems a bit slow to me.  Here are some other solutions: 
> http://graphics.stanford.edu/~seander/bithacks.html#ZerosOnRightLinear
>
> (of course, by the time you're working with integers that are large enough 
> for this to matter, you won't be enumerating gray codes with them)

The most beautiful way to do this is certainly this one :
http://supertech.csail.mit.edu/papers/debruijn.pdf

I don't remember where I read it. Possibly in the FXTbook. Or
"Hacker's delight".

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to