'''
A 1-interesting polygon is just a square with a side of length 1. 
An n-interesting polygon is obtained by taking the n - 1-interesting polygon and 
appending 1-interesting polygons to its rim, side by side. 

'''

def solution(n):
    return n**2 + (n-1)**2
    #if n == 1:
    #    return 1
    #
    #return solution(n -1) + 4 * (n - 1)
    #return -1

print(
    solution(2)
) #output 5

print(
    solution(3)
) #output 13

print(
    solution(700)
) #output 9798601

print(
    solution(1000)
) #output 1998001

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: