C# Shape Area
static long ShapeArea(long n)
{
    return n > 1 ? ShapeArea(n - 1) + 4 * (n - 1) : 1;
}

This returns the area of the growing n-interesting polygon using the direct formula instead of building the shape.

Elixir Shape Area
defmodule ShapeArea do
  def shape_area(1), do: 1
  def shape_area(n), do: shape_area(n - 1) + 4 * (n - 1)
end

This returns the area of the growing n-interesting polygon using the direct formula instead of building the shape.

Erlang Shape Area
-module(shape_area).
-export([shape_area/1]).

shape_area(N) when N =< 1 ->
    1;
shape_area(N) ->
    shape_area(N - 1) + 4 * (N - 1).

This returns the area of the growing n-interesting polygon using the direct formula instead of building the shape.

Go Shape Area
func shapeArea(n int) int {
	if n > 1 {
		return shapeArea(n-1) + 4*(n-1)
	}

	return 1
}

This returns the area of the growing n-interesting polygon using the direct formula instead of building the shape.

Haskell Shape Area
shapeArea :: Int -> Int
shapeArea n
  | n > 1     = shapeArea (n - 1) + 4 * (n - 1)
  | otherwise = 1

This returns the area of the growing n-interesting polygon using the direct formula instead of building the shape.

Java Shape Area
public class Solution {
    public static long shapeArea(int n) {
        return n > 1 ? shapeArea(n - 1) + 4L * (n - 1) : 1;
    }
}

This returns the area of the growing n-interesting polygon using the direct formula instead of building the shape.

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.

PHP Shape Area
function shapeArea($n) {
    return $n > 1 ? shapeArea($n-1) + 4*($n-1) : 1;
}

This returns the area of the growing n-interesting polygon using the direct formula instead of building the shape.

Python Shape Area
def shape_area(n: int) -> int:
    return shape_area(n - 1) + 4 * (n - 1) if n > 1 else 1

This returns the area of the growing n-interesting polygon using the direct formula instead of building the shape.

Rust Shape Area
fn shape_area(n: i64) -> i64 {
    if n > 1 {
        shape_area(n - 1) + 4 * (n - 1)
    } else {
        1
    }
}

This returns the area of the growing n-interesting polygon using the direct formula instead of building the shape.