You are viewing a single comment's thread. Return to all comments →
import sys t = int(input().strip()) for a0 in range(t): n = int(input().strip()) print(pow((n*(n+1)//2), 2)-((n*(n+1)*(2*n+1)//6)))
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #6: Sum square difference
You are viewing a single comment's thread. Return to all comments →