Here is stand-alone C# code for the functions
LogGamma. Both require a positive argument.
Why are there separate functions for gamma and its logarithm? See this post for an explanation.
Note that the functions
LogGamma are mutually dependent, but do not depend on anything else.