Consider the equation below:
2 ** n = A
Let us assume A=64.
What is the easiest way to find the value of n?
I am currently using following two approaches
A= 64; n = 1; n+=1 while (A >> n) > 0; n-1
A= 64; n = 0; n+=1 until (A == ( 2 ** n));n
Is there a better approach?
Other way of stating the same problem:
2 = nth root A If I know the value of A, how do I determine the value of n?