# Intro and Multiples of 3 and 5

Hello all!

I’ll insert a small introduction here. Welcome to my blog, my name is Corbin Frisvold and I’m a student interested in furthering my passions for Computer Science, Mathematics, and several other fields. Here my posts will primarily consist of my exploration into becoming a better programmer, but I will likely post other things around on the blog. Anyways, onto my first post!

Today I’m going to be doing a problem from Project Euler.
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.

I find it useful to just dive into the code for a small problem like this. We know we want a for loop iterating through 1000 and checking each number’s divisibility by 3 or 5. What I come out with is this:


sum = 0
for i in range(1000):
if i % 3 == 0:
sum += i
elif i % 5 == 0:
sum += i
print(sum)


What this code does is it creates a variable sum that will be used to store the sum of all our valid multiples. Then we use a for loop increment through all numbers between 1 and 1000. After running the program will print the output. Running this we get sum = 233168. And now we have solved Problem 1! My intention with post frequency is to post as much as I can, but I will attempt to keep a minimum frequency of 1 or 2 posts a week.

Thanks for reading and have a wonderful day!
~ Corbin