factorial function works for n = 0