You when say log 2^8 do you mean log 256, 2^8= 256

Or log(base 8) 2?

log 2^8 ~=2.408 rounded down is 2.

log(base2) 8 is 3.

I am just curious about your notation.

public static int floorLog(int base, int value){

if (value == 1)

{

return 0;

}

if (base == value)

{

return 1;

}

else

{

return 1 + floorLog(base * base, value);

}

}

Just a few thoughts off the top of my head. I gotta get to class, sorry for the lack of details.

That looks like infinite recursion to me, value stays the same, while base base increases and there is no guarantee that it will ever equal value. You need a value that changes each recursive call that is used for the exit condition.

Google for the power series of log and use the fact that log(base n) x <==> log(base 10) x/log(base n). Hopefully that can point you in the right direction.

[ April 10, 2006: Message edited by: Rusty Shackleford ]