, , the factorial of is defined to be factorial numbers grow large very rapidlyas you can see recursive method similar to triangle(can be used to calculate factorials it looks like thisint factorial(int nif( == return else return ( factorial( - )there are only two differences between factorial(and triangle(firstfactorial(uses an instead of in the expression factorial( - secondthe base condition occurs when is not here' some sample interaction when this method is used in program similar to triangle javaenter number factorial = figure shows how the various incarnations of factorial(call themselves when initially entered with = calculating factorials is the classic demonstration of recursionalthough factorials aren' as easy to visualize as triangular numbers various other numerological entities lend themselves to calculation using recursion in similar waysuch as finding the greatest common denominator of two numbers (which is used to reduce fraction to lowest terms)raising number to powerand so on againwhile these calculations are interesting for demonstrating recursionthey probably wouldn' be used in practice because loop-based approach is more efficient