Search found 2 matches

Return to advanced search

Powers of two less than/equal to a given number  TOPIC_SOLVED

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.
by Math Salesman
on Mon Oct 25, 2010 11:21 pm
 
Forum: Discrete Math
Topic: Powers of two less than/equal to a given number
Replies: 1
Views: 1148

Re: Powers of two less than/equal to a given number  TOPIC_SOLVED

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.
by Math Salesman
on Mon Oct 25, 2010 11:26 pm
 
Forum: Discrete Math
Topic: Powers of two less than/equal to a given number
Replies: 1
Views: 1148

Return to advanced search