Added function to calculate stirling value