heehee ... it took me a while, too. In the end, of course, return was working perfectly. The trick was that the recursion stack was 6 levels deep, and only the top level returned anything. This works now:
def increasex(num,b2,x):
print "num, b2, x", num, b2, x
if num%(b2**x) < num:
x = x+1
# increase(num, b2, x) ## original
return increasex(num, b2, x)
else:
print x
return x
Go through the original code with num = 32, b1 = 10, b2 = 2, and x = 5 ... that is, the next-to-last time through the recursion. It hits the if statement, takes the 'if' branch, adds 1 to x, and calls increasex(32,10,6). increasex(32,10,6) hits the if statement, takes the 'else' branch, returns 6 to the caller...which was increasex(32,10,5)! But that's done, so it drops out of the conditional, comes to the end of the function, and returns None to the caller ... which was increasex(32,10,4) ... which returns None to increasex(32,10,3) ... and so on.
Moral: recursive functions should always return something. :)
Jeff