recursive arithmetic functions in swift