Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is_power_of_two? #82

Open
mluu510 opened this issue Dec 2, 2015 · 1 comment
Open

is_power_of_two? #82

mluu510 opened this issue Dec 2, 2015 · 1 comment

Comments

@mluu510
Copy link
Member

mluu510 commented Dec 2, 2015

so i tried out the solution to is_power_of_two? with is_power_of_two?(9), it returns false. is this a bug in the code?

@jaysonvirissimo
Copy link
Member

It's my understanding that 'power of two' refers to a number that can be expressed in the form 2^n, where n is an integer (such as 2^5 or 32). You may be thinking of a square number, which has the form x^2, where x is an integer (like 3^2 or 9). The difference is that, in the former, the base is 2, while in the later, the exponent is 2.

Does that make sense?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants