Added a break condition for polygamma_nearzero using Stirling's approximation to check for factorial overflow