Subject: Re: The while loop for calculating a power of a number less than another number?
From: "Kevin" <kevin_olbrich yahoo.com>
Date: Sat, 30 Jul 2005 00:51:02 +0900
References: 150005150008
this is odd since you don't need to loop to find the answer
maxnum = 10_000
n = 2 ** (Math.log(maxnum) / Math.log(2)).floor
puts n + " is the largest power of 2 less than " + maxnum