I want to find the greatest integer less than or equal to the kth root of n. I tried
int(n**(1/k))
But for n=125, k=3 this gives the wrong
You can round to nearest integer instead of rounding down / to zero (I don't know what Python specifies) :
def rtn (x): return int (x + 0.5) >>> rtn (125 ** (1/3)) 5