https://projecteuler.net/problem=6
The sum of the squares of the first ten natural numbers is,
$$1^2 + 2^2 + ... + 10^2 = 385$$The square of the sum of the first ten natural numbers is,
$$(1 + 2 + ... + 10)^2 = 552 = 3025$$Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 − 385 = 2640.
In [19]:
def sum_of_square(x): #PERSONAL NOTES FOR LATER CODING
n=0 #I may need another value holder(variable)
for i in range(1,101):
#need equations to define problem
n ** 2 + i == x #ignore this cell
print ()
In [9]:
# This cell will be used for grading, leave it at the end of the notebook.
In [ ]:
In [49]:
def sum_stuff():
return sum(range(1,101))**2 - sum([n**2 for n in range(1,101)]) # just math, first term has sum of all numbers from
print(sum_stuff()) # from 1 to 100 and second term has the sum of the squares
# of numbers from 1 to 100
In [ ]: