*Recreation of [Project Euler problem #6](https://projecteuler.net/problem=6)*

Find the difference between the sum of the squares of the first `n` natural numbers `(1 <= n <= 100)` and the square of their sum.

## Example
For example, when `n = 10`:

* The square of the sum of the numbers is:

  (1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10)^(2) = 55^(2) = 3025


* The sum of the squares of the numbers is:

 1^(2) + 2^(2) + 3^(2) + 4^(2) + 5^(2) + 6^(2) + 7^(2) + 8^(2) + 9^(2) + 10^(2) = 385

Hence the difference between square of the sum of the first ten natural numbers and the sum of the squares of those numbes is: 3025 - 385 = 2640

Difficulty: EASY
Tags: Fundamentals

Starter code:
def difference_of_squares(n):
	

Solutions:
def difference_of_squares(x):
	r = range(1, x + 1, 1)
	return sum(r) ** 2 - sum((z ** 2 for z in r))


difference_of_squares = lambda n: n ** 2 * (n + 1) ** 2 / 4 - n * (n + 1) * (2 * n + 1) / 6


def difference_of_squares(x):
	square_sum = 0
	sum_squares = 0
	for i in range(1, x + 1):
		square_sum += i
		sum_squares += i ** 2
	square_sum **= 2
	return square_sum - sum_squares


def difference_of_squares(n):
	return (3 * n ** 4 + 2 * n ** 3 - 3 * n ** 2 - 2 * n) / 12


def difference_of_squares(x):
	return (3 * x ** 4 + 2 * x ** 3 - 3 * x ** 2 - 2 * x) // 12


def difference_of_squares(n):
	sum_of_squares = n * (n + 1) * (2 * n + 1) // 6
	square_of_sum = (n * (n + 1) // 2) ** 2
	return square_of_sum - sum_of_squares


def difference_of_squares(n):
	sum_of_squares = 0
	square_of_sum = 0
	for i in range(1, n + 1):
		square_of_sum += i
		sum_of_squares += i ** 2
	return square_of_sum ** 2 - sum_of_squares


def difference_of_squares(n):
	return sum((i for i in range(1, n + 1))) ** 2 - sum((i * i for i in range(1, n + 1)))


def difference_of_squares(n):
	return sum(range(n + 1)) ** 2 - sum(map(lambda x: x ** 2, range(n + 1)))


def difference_of_squares(x):
	return sum(range(x + 1)) ** 2 - sum((i ** 2 for i in range(x + 1)))


def difference_of_squares(n):
	return sum((n - i for i in range(0, n))) ** 2 - sum(((n - i) ** 2 for i in range(0, n)))


def difference_of_squares(x):
	return x * (x + 1) * (x * (x + 1) / 4 - (2 * x + 1) / 6)


def difference_of_squares(n):
	a = sum([i for i in range(1, n + 1)]) ** 2
	b = sum([i ** 2 for i in range(1, n + 1)])
	return a - b


def difference_of_squares(n):
	if 1 <= n <= 100:
		lst = []
		for i in range(1, n + 1):
			lst.append(i)
			s = sum(lst) ** 2
		l = []
		for i in range(1, n + 1):
			l.append(i ** 2)
			t = sum(l)
	return s - t


def difference_of_squares(n):
	s1 = 0
	for i in range(1, n + 1):
		s1 += i ** 2
	somme2 = [i for i in range(1, n + 1)]
	s2 = sum(somme2) ** 2
	return abs(s1 - s2)


def difference_of_squares(n):
	n1 = sum(range(1, n + 1))
	return n1 * n1 - sum([i * i for i in range(1, n + 1)])


def difference_of_squares(n):
	sum1 = 0
	sum2 = 0
	for x in range(n):
		sum1 += x + 1
		sum2 += (x + 1) ** 2
	return sum1 ** 2 - sum2


def difference_of_squares(n):
	sq_sums = 0
	sum_sqs = 0
	for i in range(1, n + 1):
		sq_sums += i ** 2
	for j in range(1, n + 1):
		sum_sqs += j
	return sum_sqs ** 2 - sq_sums


def difference_of_squares(n):
	sum1 = 1
	sum2 = 1
	i = 1
	while i < n:
		sum1 += i + 1
		sum2 += (i + 1) ** 2
		i += 1
	return sum1 ** 2 - sum2


def difference_of_squares(n):
	sum_squares = 0
	sum_num = 0
	for i in range(1, n + 1):
		sum_squares = sum_squares + i * i
		sum_num = sum_num + i
	return sum_num ** 2 - sum_squares


def difference_of_squares(n):
	return (n * (n + 1) / 2) ** 2 - sum((x ** 2 for x in range(1, n + 1)))


def difference_of_squares(n):
	nat_num = 0
	for i in range(0, n + 1):
		nat_num += i
	sqr_nat = nat_num ** 2
	sum_sqr = 0
	for b in range(0, n + 1):
		sum_sqr += b ** 2
	return sqr_nat - sum_sqr


import numpy as np

def difference_of_squares(n):
	return sum(range(1, n + 1)) ** 2 - sum(np.array(range(1, n + 1)) ** 2)


def difference_of_squares(n):
	(s1, s2) = (0, 0)
	for i in range(1, n + 1):
		s1 += i
		s2 += i ** 2
	return s1 ** 2 - s2


def difference_of_squares(n):
	rng = []
	sqs = []
	for i in range(1, n + 1):
		rng.append(i)
		sqs.append(i ** 2)
	return sum(rng) ** 2 - sum(sqs)


def difference_of_squares(n):
	return (n * (1 + n) / 2) ** 2 - n * (n + 1) * (2 * n + 1) / 6


def difference_of_squares(n):
	output = 0
	output2 = 0
	for i in range(0, n + 1):
		output += i
		output2 += i ** 2
	return output ** 2 - output2


def difference_of_squares(n):
	sum = 0
	square = 0
	for i in range(1, n + 1):
		sum += i ** 2
	for num in range(1, n + 1):
		square += num
	square **= 2
	return square - sum


def difference_of_squares(n):
	a = b = 0
	for i in range(1, -~n):
		a += i
		b += i * i
	return abs(a * a - b)


def difference_of_squares(n):
	arr_pow = []
	two = 0
	for i in range(1, n + 1):
		arr_pow.append(i)
		two += i ** 2
	one = sum(arr_pow)
	return one ** 2 - two


def difference_of_squares(n):
	a = list(range(1, n + 1))
	s1 = sum(a) ** 2
	arr = [el ** 2 for el in a]
	s2 = sum(arr)
	return s1 - s2


def difference_of_squares(n):
	return (n ** 2 - 1) * (3 * n + 2) * n // 12


def difference_of_squares(n):
	x = sum([i for i in range(1, n + 1)])
	return x * x - sum([i * i for i in range(1, n + 1)])


def difference_of_squares(n):
	r = list(range(n + 1))
	return sum(r) ** 2 - sum([x ** 2 for x in r])


def difference_of_squares(num):
	return sum([n for n in list(range(1, num + 1))]) ** 2 - sum([n ** 2 for n in list(range(1, num + 1))])


def difference_of_squares(n):
	a = sum([x * x for x in range(1, n + 1)])
	b = sum(range(1, n + 1))
	return b * b - a


def difference_of_squares(n):
	a = 0
	s = 0
	for i in range(n + 1):
		a += i
		s += i * i
	return a * a - s


def difference_of_squares(n):
	return sum((el for el in range(n + 1))) ** 2 - sum((el ** 2 for el in range(n + 1)))


def difference_of_squares(n):
	(a, b) = (0, 0)
	for x in range(1, n + 1):
		a += x
		b += x ** 2
	return a ** 2 - b


def difference_of_squares(n):
	(square_sum, sum_square) = (0, 0)
	for i in range(1, n + 1):
		square_sum += i
		sum_square += i ** 2
	return square_sum ** 2 - sum_square


def difference_of_squares(n):
	sum_n_range = sum([i for i in range(n + 1)]) ** 2
	square_n_range = sum([i ** 2 for i in range(n + 1)])
	return sum_n_range - square_n_range


def difference_of_squares(n):
	sum_n = 0
	sum_n2 = 0
	for i in range(1, n + 1):
		sum_n += i
		sum_n2 += i ** 2
	sum_n = sum_n ** 2
	return sum_n - sum_n2


def difference_of_squares(n):
	fuck = sum(range(n + 1)) ** 2
	cunt = sum(map(lambda x: x ** 2, range(1, n + 1)))
	return fuck - cunt


def difference_of_squares(n):
	squares_sum = sum([i for i in range(1, n + 1)]) ** 2
	sum_squares = sum([i ** 2 for i in range(1, n + 1)])
	return squares_sum - sum_squares


def difference_of_squares(n: int) -> int:
	return 0.25 * n ** 2 * (n + 1) ** 2 - n * (n + 1) * (2 * n + 1) / 6


difference_of_squares = lambda n: n ** 4 // 4 + n ** 3 // 6 - n ** 2 // 4 - n // 6


def difference_of_squares(n):
	sum_1 = 0
	sum_2 = 0
	for num in range(1, n + 1):
		sum_1 += num
		sum_2 += num ** 2
	return sum_1 ** 2 - sum_2


def difference_of_squares(n):
	num1 = sum((i for i in range(1, n + 1))) ** 2
	num2 = sum((i ** 2 for i in range(1, n + 1)))
	return abs(num1 - num2)


def difference_of_squares(n):
	(sume1, sume2) = (0, 0)
	for i in range(1, n + 1):
		sume1 += i
		sume2 += i ** 2
	sume1 = sume1 ** 2
	return sume1 - sume2


def difference_of_squares(n):
	a = 0
	b = 0
	for i in range(1, n + 1):
		a += i
		b += i ** 2
	c = a ** 2
	return c - b


def difference_of_squares(n):
	sum_sqr = 0
	sum_sqrs = 0
	for n in range(1, n + 1):
		sum_sqr += n
		sum_sqrs += n ** 2
	sum_sqr = sum_sqr ** 2
	return sum_sqr - sum_sqrs


def difference_of_squares(n):
	sum_up_to_n = n * (n + 1) // 2
	return sum_up_to_n ** 2 - sum((num ** 2 for num in range(1, n + 1)))


def difference_of_squares(n):
	summa = 0
	atseviski = 0
	for i in range(1, n + 1):
		summa += i
	summa = summa ** 2
	for x in range(1, n + 1):
		atseviski += x ** 2
	return abs(summa - atseviski)


def difference_of_squares(n):
	sumOfSquares = 0
	sum = 0
	for x in range(1, n + 1):
		sumOfSquares += x * x
		sum += x
	return sum * sum - sumOfSquares


def difference_of_squares(n):
	total = 0
	sums = 0
	for i in range(1, n + 1):
		sums += i ** 2
		total += i
	return total ** 2 - sums


def difference_of_squares(n):
	sum_1 = 0
	sum_2 = 0
	for i in range(1, n + 1):
		sum_1 = sum_1 + i * i
	for i in range(1, n + 1):
		sum_2 = sum_2 + i
	return sum_2 * sum_2 - sum_1


def difference_of_squares(n):
	return sum(range(1, n + 1)) ** 2 - sum(map(lambda a: a ** 2, range(1, n + 1)))


def difference_of_squares(n):
	n = range(n + 1)
	new = [i for i in n]
	sum_1 = sum(new) ** 2
	new_x = [i ** 2 for i in n]
	sum_2 = sum(new_x)
	res = sum_1 - sum_2
	print(res)
	return res


def difference_of_squares(n):
	return (n * (n + 1) * 0.5) ** 2 - n * (n + 1) * (2 * n + 1) / 6


def difference_of_squares(n):
	y = sum((i for i in range(1, n + 1)))
	z = sum((i ** 2 for i in range(1, n + 1)))
	return y ** 2 - z


def difference_of_squares(n):
	total = 0
	total_2 = 0
	for i in range(0, n + 1):
		total += int(i)
	total = total ** 2
	for i in range(0, int(n) + 1):
		total_2 += i ** 2
	return total - total_2


def difference_of_squares(n):
	sum_square = 0
	sum_numbers = 0
	for i in range(1, n + 1):
		sum_square += i ** 2
	for i in range(1, n + 1):
		sum_numbers += i
	squared = sum_numbers ** 2
	return squared - sum_square


def difference_of_squares(n):
	x1 = sum([i for i in range(1, n + 1)]) ** 2
	x2 = sum([i ** 2 for i in range(1, n + 1)])
	return x1 - x2


def difference_of_squares(n):
	n_sum = 0
	sum_of_squares = 0
	for number in range(n + 1):
		n_sum += number
		sum_of_squares += number ** 2
	square_of_sum = n_sum ** 2
	return square_of_sum - sum_of_squares


def difference_of_squares(n):
	sq_of_sum = sum((i for i in range(n + 1))) ** 2
	sum_of_sq = sum((i ** 2 for i in range(n + 1)))
	return sq_of_sum - sum_of_sq


difference_of_squares = lambda n: (lambda r, s: s(sum(r)) - sum(map(s, r)))(range(1, n + 1), 2 .__rpow__)


def difference_of_squares(n):
	lst1 = [x + 1 for x in range(n)]
	lst2 = [(x + 1) ** 2 for x in range(n)]
	return abs(sum(lst2) - sum(lst1) ** 2)