Adopted new convention from template

This commit is contained in:
David Doblas Jiménez 2022-09-28 20:36:06 +02:00
parent 273aeea7f8
commit 8c0f18bc5f

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python
"""
Created on 3 Jan 2020
@ -29,20 +29,20 @@ def compute():
What is the sum of the numbers on the diagonals in a 1001 by 1001 spiral
formed in the same way?
"""
size = 1001 # Must be odd
ans = 1 # Special case for size 1
ans = 1 # Special case for size 1
step = 0
i, cur = 1, 1
while step < size-1:
i, current = 1, 1
while step < size - 1:
step = i * 2
for j in range(1, 5):
cur += step
ans += cur
for _ in range(1, 5):
current += step
ans += current
i += 1
return ans
if __name__ == "__main__":
print(f"Result for Problem 28: {compute()}")
print(f"Result for Problem 28 is {compute()}")