You are viewing a single comment's thread. Return to all comments →
Heres my code with derivation link below if anyone wants to check it out:
#!/bin/python3 t = int(input().strip()) for a0 in range(t): n = int(input().strip()) square_of_sum = ((n * (n+1))// 2) ** 2 sum_of_squares = (((n) * (n+1) * (2*n+1)) // 6) print(square_of_sum-sum_of_squares)
Derivation
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 →
Heres my code with derivation link below if anyone wants to check it out:
Derivation