# nth root of n!

Last week the function came up in a blog post as the solution to the equation n! = bn.

After writing that post I stumbled upon an article  that begins by saying, in my notation,

The function b(x) … has many applications in pure and applied mathematics.

The article mentions a couple applications but mostly focuses on approximations and bounds for the function b(x) and especially for the ratio b(x)/b(x + 1). In the article x is a positive real number, not necessarily an integer. One of the results is the approximation which is the beginning of an asymptotic series given in the paper.

Another result is the following upper and lower bounds on b(n). Let’s look at some examples of these results using the following Python script.

    from numpy import exp, pi
from scipy.special import loggamma

b = lambda x: exp(loggamma(x+1)/x)

bratio = lambda x: b(x)/b(x+1)

bratio_approx = lambda x: (2*pi*x)**(0.5/(x*(x+1)))

def lower_bound_b(x):
r = exp(-0.5/x) * x*(2*pi*x)**(0.5/x)
r /= (1 + 1/x)**x
return r

def upper_bound_b(x):
return lower_bound_b(x)*exp(5/(12*x*x))

for x in [25, 100, 1000]:
print(bratio(x), bratio_approx(x))

for x in [25, 100, 1000]:
print(lower_bound_b(x), b(x), upper_bound_b(x))


The code exercising the ratio approximation prints

    0.964567 1.003897
0.990366 1.000319
0.999004 1.000004


and the code exercising the lower and upper bounds prints the following.

     10.170517  10.177141   10.177299
37.991115  37.992689   38.992698
369.491509 369.491663  369.491663


 Chao-Ping Chen and Cristinel Mortici. Asymptotic expansions and inequalities relating to the gamma function. Applicable Analysis and Discrete Mathematics, Vol. 16, No. 2 (October, 2022), pp. 379–399

## 2 thoughts on “nth root of n!”

1. James Paget

The definition for upper_bound_b should be:
return lower_bound_b(x)*exp(5/(12*x*x))
This gives a much tighter upper bound.

2. Thanks. Typo fixed.