Function Collatz(i) Dim j As Integer j = i / 2 If (j * 2) = i Then Collatz = i / 2 Else Collatz = i * 3 + 1 End If End Function