Ad
  • Default User Avatar

    Maybe, in function Thirt, you should set result and tempPrevResult without call recursiveCalculation?

    func Thirt(n int) int {
      // set initial value of result
      result = n
      // iterating until condition met
      for result != tempPrevResult {
        recursiveCalculation(result)
      }
      return result
    }