Actually, you are trying to solve the inequality
because the algorithm is only going to be faster for a very short time, and then for any larger values of n, the algorithm will be faster.
Ignore the case n <= 0, multiply by 10, and divide by n to produce:
Then divide by 20 and exponentiate both sides with a base of 10:
Use a numeric solver to find the zeros of on the interval [1, 40] since clearly 40 is an upper bound (because ).
For instance, in Matlab:
>> fzero(@(x) 10^(x/20)- x, 20)
ans =
29.3531
So for any n an integer up through 29, the algorithm is faster, and for n > 29, the algorithm wins.