problem1 Sum all multiples of 3 or 5 up to given limit

  1. Verifies whether or not the parameter given is compliant

  2. Do the calculations

problem1(limit)

Arguments

limit

A positive integer.

Value

The total of the sum.

Complexity

This function has the following complexity O(n)

See also

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

Examples

problem1(10)
#> [1] 23
problem1(100)
#> [1] 2318
problem1(1000)
#> [1] 233168