gamma function implemented