I'm looking for an algorithm for the incomplete gamma function to compute P-values for Chi-square test. Know any good resources?