Lisp Shape Area
(defun shape-area (n)
(if (> n 1)
(+ (shape-area (1- n)) (* 4 (1- n)))
1))
This returns the area of the growing n-interesting polygon using the direct formula instead of building the shape.
(defun shape-area (n)
(if (> n 1)
(+ (shape-area (1- n)) (* 4 (1- n)))
1))
This returns the area of the growing n-interesting polygon using the direct formula instead of building the shape.