I'm trying to approximate the factorial of a large number with large precision. I know one can use the the Stirling approximation to do that with the formula: $$\sqrt{2\pi x} \left(\frac{x}{e}\right)^x$$
and I also know that there is a better approximation using: $$\sqrt{2\pi x} \left(\frac x e \right)^x \left(1+\frac{1}{12x}+\frac{1}{288x^2}-\frac{139}{51840x^3}-\frac{571}{2488320x^4}+\cdots \right)$$
but how are those coefficients in $\left(1+\frac{1}{12x}+\frac{1}{288x^2}-\frac{139}{51840x^3}-\frac{571}{2488320x^4}+\cdots\right)$ chosen?