Let's assume you have the following numerical output pattern for a function
(function 0) = sqrt(6)
(function 1) = sqrt(6 + (2 * sqrt(7)))
(function 2) = sqrt(6 + (2 * sqrt(7 + (3 * sqrt(8)))))
etc...
In scheme I have the following recursive function to calculate this pattern
(define (function depth)
(cond
((= depth 0) (sqrt 6))
(else (+ (function (- depth 1)) (* (+ depth 1) (sqrt (+ depth 6)))))
)
)
I can't figure out how to write the else case so that the square root is nested. Can someone give me a suggestion?