Untitled

Anonymous
plain_text
02/23/2023 3:21 PM
304 B
22
Indexable
# User input for n

n = int(input())

# Sum of the squares of the first n numbers
sum = (n*(n+1)*(2*n+1))/6
print(int(sum))

total = 0
for i in range(1,n+1):
    total += i

total *= total

print(int(total - sum))
Editor is loading...