the world' simplest recursive definition is probably the factorial function (typically written in mathematics using !on natural numbers the classic inductive definition is ( )( nthe first equation defines the base case the second equation defines factorial for all natural numbersexcept the base casein terms of the factorial of the previous number figure contains both an iterative (factiand recursive (factrimplementation of factorial def facti( )"""assumes that is an int returns !""result while result result - return result def factr( )"""assumes that is an int returns !""if = return elsereturn *factr( figure iterative and recursive implementations of factorial this function is sufficiently simple that neither implementation is hard to follow stillthe second is more obvious translation of the original recursive definition it almost seems like cheating to implement factr by calling factr from within the body of factr it works for the same reason that the iterative implementation works we know that the iteration in facti will terminate because starts out positive and each time around the loop it is reduced by this means that it cannot be greater than forever similarlyif factr is called with it returns value without making recursive call when it does make recursive callit always does so with value one less than the value with which it was called eventuallythe recursion terminates with the call factr( fibonacci numbers the fibonacci sequence is another common mathematical function that is usually defined recursively "they breed like rabbits,is often used to describe population that the speaker thinks is growing too quickly in the year the the exact definition of "natural numberis subject to debate some define it as the positive integers and others as the nonnegative integers that' why we were explicit about the possible values of in the docstring in figure