func() is given as root function. So, we write it as n, n1/k, n1/k2, n1/k3, …, n1/kp
Where we assume that n1/kp is the last term that is >0 (lets take it to be = e) according to the loop.(e = smallest positive root) Now
n1/kp = e
taking log on both sides (1/k)p loge(n) = loge(e)
(1/k)p loge(n) = 1
log(n) = kp
again taking log on both the sides log(loge(n)) = p log(k)
therefore p = [log(loge(n)) ] / [log(k)]
we know that [log (a)] / [log(b)] = logba
therfore p = logk(loge(n)