First off, I apologize for my inaccurate vocabulary. I am an absolute ground-zero beginner. Anyways, I am attempting to solve this problem: http://projecteuler.net/problem=1
To be brief, I'm trying to write a script that will find the sum of all the multiples of 3 or 5 below 1000.
My (extremely basic) approach was with this program:
##Multiples of 3
x = range(3, 1000, 3)
##Multiples of 5
y = range(5, 1000, 5)
a = sum(x)
b = sum(y)
n = a + b
print n
I realized that this was wrong because there are numbers like 15 that are included twice (it's a multiple of both 5 and 3). So is there a way to fix this or am I approaching this problem from a completely wrong angle? Or do I need to just study more before I try solving this problem? I also apologize if this has been explained in a previous post, but I looked around for a bit.