Renamed all folders

This commit is contained in:
2021-04-16 16:58:48 +02:00
parent dbc6cfef05
commit 197b3eea8a
62 changed files with 0 additions and 0 deletions

31
028/main.py Normal file
View File

@@ -0,0 +1,31 @@
# Number spiral diagonals
# Find the sum of the numbers on the diagonals of a 1001 by 1001 spiral
def sumSpiralDiagonals(n):
assert n % 2 == 1
if n == 1:
return 1
result = 0
corner = 1
for i in range(1, n+1, 2):
if i == 1:
result += corner
else:
for j in range(4):
corner += i - 1
result += corner
return result
def main():
print("Hello, this is Patrick")
print(sumSpiralDiagonals(1001))
if __name__ == "__main__":
main()