power of 2 Algorithm

In mathematics, a power of two is a number of the form 2n where N is an integer, that is, the consequence of exponentiation with number two as the base and integer N as the exponent. In a context where only integers are considered, N is restricted to non-negative values, so we have 1, 2, and 2 multiply by itself a certain number of times.

power of 2 source code, pseudocode and analysis