updated combinatorial function for greater accuracy