Skip to content

Instantly share code, notes, and snippets.

@tomfa
Created April 25, 2020 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomfa/e631a3bd488ccffd8383725518afc218 to your computer and use it in GitHub Desktop.
Save tomfa/e631a3bd488ccffd8383725518afc218 to your computer and use it in GitHub Desktop.
def numbers(width):
assert width % 2 == 1, "Need odd numbered size"
sum = 1
last_number = 1
i = 3
while i <= width:
sum += last_number * 4 + (i - 1) * 10
last_number += (i - 1) * 4
i += 2
return sum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment