Created
April 25, 2020 19:55
-
-
Save tomfa/e631a3bd488ccffd8383725518afc218 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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