problem6 finds the difference between the sum of the squares of the first 'n' natural numbers and the square of the sum.

problem6(limit)

Arguments

limit

Limit to run the interval

Value

The expected value

Complexity

This function has the following complexity O($n^2$)

See also

https://projecteuler.net/problem=6 for more info about it

Examples

problem6(10)
#> [1] 2640
problem6(20)
#> [1] 41230
problem6(50)
#> [1] 1582700