- Mon Oct 25, 2010 11:26 pm
- Forum: Discrete Math
- Topic: Powers of two less than/equal to a given number
- Replies:
**1** - Views:
**1383**

I just realized that by taking the 'floor' of the base-two logarithm of the number and adding one, I will have the desired result.

- Mon Oct 25, 2010 11:21 pm
- Forum: Discrete Math
- Topic: Powers of two less than/equal to a given number
- Replies:
**1** - Views:
**1383**

For a given number n, is there a way to determine in general the number of powers of two which are less/equal to n?

I should add that I mean integers.

For example, there are five powers of two less than/equal to 31: 1, 2, 4, 8, 16.

There are two less than/equal to 2: 1, 2

etc.

I should add that I mean integers.

For example, there are five powers of two less than/equal to 31: 1, 2, 4, 8, 16.

There are two less than/equal to 2: 1, 2

etc.