R function sumFactorial and sumRange fixed