You are viewing a single comment's thread. Return to all comments →
This is pretty cleaver. Took me a minute or to to figure out why it works. For those that want to learn it's in how the & operator works
say we start out with 5869
5869 = 1011011101101 <<1 = 0110111011010 & = 0010011001000 = 1224 <<1 = 0100110000000 & 0000010000000 = 128 <<1 = 0000100000000 & = 0000000000000 = 0
thats 3 cycles. which is the answer. I love simple elegant solutions. too many of the newer languages have too many steps.
Seems like cookies are disabled on this browser, please enable them to open this website
Day 10: Binary Numbers
You are viewing a single comment's thread. Return to all comments →
This is pretty cleaver. Took me a minute or to to figure out why it works. For those that want to learn it's in how the & operator works
say we start out with 5869
thats 3 cycles. which is the answer. I love simple elegant solutions. too many of the newer languages have too many steps.