xxxxxxxxxx
17
//solution for Euler Project's Problem 1
//https://projecteuler.net/problem=1
//sum of multiples of 5 (<1000), using formula for arithmetic series
let sum = (5 + 995) / 2 * 199;
//sum multiples of 3 (<1000) that are not multiples of 5
let n = 3;
while (n < 1000) {
if (n % 5 !== 0) {
sum += n;
}
n += 3;
}
console.log(sum);
//Note: Answer is reasonable since 1 + 2 + 3 + ... = 500500.