Hi dear forumers !

I have some trouble solving for n in this equation :

$\displaystyle p=\frac{\left ( 1-a^2 \right )^{(n-1)/2}}{a\sqrt{2\pi n }}$

I know the solution involves the Lambert W function (inverse of n*e^n). However I can't get n to be isolated on one side .

$\displaystyle pa\sqrt{2\pi n }=\left ( 1-a^2 \right )^{(n-1)/2}$

$\displaystyle p^2a^22\pi n=\left ( 1-a^2 \right )^{(n-1)}$

$\displaystyle \ln \left ( p^2a^22\pi n \right )=(n-1)\ln\left ( 1-a^2 \right )$

$\displaystyle \ln \left ( p^2a^22\pi \right )=(n-1)\ln\left ( 1-a^2 \right )-\ln(n)$

$\displaystyle \ln \left ( p^2a^22\pi \right )+\ln\left ( 1-a^2 \right )=n\ln\left ( 1-a^2 \right )-\ln(n)$

From there I am stuck. Thank you very much for your help !