Created
April 25, 2020 19:55
-
-
Save tomfa/9948b7a7a2eb8063b3eb0e44603419be 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