[font=courier new]How about, composition of recursive functions?
'This script runs OK.
'But, it is easy to cause "stack" overflow in the function gcd().
'For me, gcd(2585, 1), results in Windows saying the program has stopped working.
Console_WriteLine(gcd(fib(fact(ack(1, 1))), 13))
Console_WriteLine("Done. Press a key.")
' -- Nested recursion: Recursive call to function contains recursive call to itself in the arguments
' -- Ackermann function
Function ack(x As Number, y As Number) As Number
If x = 0 Then Return y+1
If y = 0 Then Return ack(x-1, 1)
Return ack(x-1, ack(x, y-1))
' -- Cascade (tree) recursion: Multiple occurrences of recursive call appear in one expression, but without any nesting
' -- Fibonacci
Function fib(n As Number) As Number
If n <= 1 Then Return 1
' -- Linear recursion: Each alternative of definition contains 1 recursive call at max.
' -- Factorial
Function fact(n As Number) As Number
If n = 0 Then Return 1
Return n * fact(n-1)
' -- End recursion: Special case of linear recursion, where recursive call is the last operation of specific alternative of definition
' -- Greatest common divisor
Function gcd(x As Number, y As Number) As Number
If x = y Then Return x
If x > y Then Return gcd(x-y, y)
Return gcd(x, y-x)