Just out of curiosity, how can you tell if a number x is a power of two (x = 2^n) without using recursion.
Thanks
For completeness, if the number is a float, you can test if it's a power of two by chacking if the mantissa is all zeros:
Exercise for the reader: corner cases and big-endian machines.