Project Euler - Problem 1

Problem 1

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Find the sum of all the multiples of 3 or 5 below 1000.

Solution

I used simple brute force to solve this problem:
I iterate through all the numbers less than the given limit and check
if a number is a factor of 3 or 5 adding to the total if it is.

    def PE001(limit):
        total = 0
        for n in range(3, limit):
            if n % 3 == 0 or n % 5 == 0:
                total += n
        return total
    print(PE001(1000))
    
Answer: 233168