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

Python code

I am sure this question has been ask a lot, but I have checked other forums and have tried addressing the issue. Which, doesn't seem to help. I am thinking there is an overflow problem, but I can't remember on how to fix it. I took a long break from coding, my fault there, so I am trying some problems to help get me back in the swing of things.  So, just wondering as to what is going wrong. When I try n = 1000 the answer is wrong but numbers pretty much smaller than that seem to work out right. So, since numbers large won't work I think of integer overflow.


    def n_number():
        n = raw_input("Enter a max number: ")
        try:
	    int(n)
	    return n

        except ValueError:
	    print 'Value is not an integer'
	    exit(1)

    'function that will add multiples of 3 and 5 that are less than the given value, n.'
    def sum_multiplies(n):
        sum = long(0)
        counter3, counter5 = int(1),int(1)

        value3 = 3*counter3
        value5 = 5*counter5

        while True:
	    'sums of multiples of 5\'s less than n'
	    if value5<int(n):
	        sum+= value5
	        counter5+=1
	        value5 = 5*counter5

	    'sums of multiples of 3\'s less than n'
	    if value3<int(n):
	        sum+= value3
	        counter3+=1
                value3 = 3*counter3

	    else:
	        break

        print "sum: %s" %sum
        print "counter3: %s" %counter3
        print "counter5: %s" %counter5

        def main():
            'max number is in n'
             n = n_number()

             sum_multiplies(n)
    
        if __name__ == "__main__":
            main()