To solve this problem I used a pretty straight forward LINQ statement. It basically just generates all the numbers from 0 to 999, filters out the numbers not dividable by 3 or 5, and then sums those up.

var multiples = new long[] {3, 5};

var answer = Enumerable

.Range(0, 1000)

.Where(x => multiples.Any(y =>; x%y == 0))

.Sum();

var answer = Enumerable

.Range(0, 1000)

.Where(x => multiples.Any(y =>; x%y == 0))

.Sum();

The answer to that would then be 233168, and it the code took less than 10 milliseconds to find.

So, how did you solve it? What do you think about my solution?