We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
defsum_of_spiral_diagonal(n):s=(16*(n**3)+30*(n**2)+26*n+3)//3returns%(10**9+7)# Read the number of test casest=int(input())# Iterate over the test casesforiinrange(t):# Read the input and divide it by 2n=int(input())// 2 # this indicates the spiral numberprint(sum_of_spiral_diagonal(n))
Cookie support is required to access HackerRank
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 →