Square Sum Gap
In math, the order of operations can completely change the result: you can square each number first, or add the numbers first and then square the sum. Write a function sum_square_difference that finds the difference between the square of the sum and the sum of the squares for the first n natural numbers. For example, for numbers from 1 to 10, compare (1 + 2 + ... + 10)^2 with 1^2 + 2^2 + ... + 10^2.
Примеры
Ввод
1Вывод
0Ввод
10Вывод
2640Ввод
100Вывод
25164150Нужно реализовать
def sum_square_difference(n: int) -> int:
Теги
math
Prijavite se za ogled zgodovine oddaj
PrijavaPrijavite se za uporabo mentorja UI
PrijavaVisible tests
1
Input
1Expected
02
Input
10Expected
26403
Input
100Expected
251641504
Input
2Expected
45
Input
3Expected
226
Input
5Expected
170Focus radio
Paused · SomaFM · Fluid