What's the advantage of this approximation in python/code? I can see it being useful analytically, but what's the advantage in code? The formula has an ^n in it, so doesn't it have the same complexity as n! ?
You compute n^n the same way you compute a^n which is to say that a^n = e^(n x log(a))
To be fair, I’m not sure whether similar optimizations exist for computing the factorial, but I don’t think so.