sufficient implementation of the gamma funtion