You are viewing a single comment's thread. Return to all comments →
python 3 passed all test cases
import sys t=int(input()) while t>0: n=int(input()) j=n*(n+1)*(2*n+1)//6 m=n*(n+1)//2 m=m*m print(m-j) t -=1
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 →
python 3 passed all test cases