You are viewing a single comment's thread. Return to all comments →
def res():
t = int(input()) for i in range(t): n = int(input())//2+1 w = n-1 result = 1+4*((n*(2*n+1)*(2*n-1))//3 -1 )-12*((w*(w+1))//2) print(result%(10**9+7))
res()
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #28: Number spiral diagonals
You are viewing a single comment's thread. Return to all comments →
code in python3
def res():
res()