

public class Problem001 {

	public static void main (String[] args){
				
		int result = 0;
		
		final int TARGET = 1000;
		
		for (int i = 3; i < TARGET; i += 3){
			if (i %  5 != 0) {
				result += i;
			}
		}
		
		for (int i = 5; i < TARGET; i += 5){
			result += i;
		}
		
		System.out.println(result);
		
	}
	
}



public class Problem001 {

	public static void main (String[] args){
		
		int result = 0;
		
		final int TARGET = 1000;
		
		// arithmetic series for 3, 5, 15.
		int multiplesOfThree = (TARGET - 1) / 3;
		result += 3 * multiplesOfThree * (1 + multiplesOfThree) * 0.5;

		int multiplesOfFive = (TARGET - 1) / 5;
		result += 5 * multiplesOfFive * (1 + multiplesOfFive) * 0.5;

		int multiplesOfFifteen = (TARGET - 1) / 15;
		result -= 15 * multiplesOfFifteen * (1 + multiplesOfFifteen) * 0.5;

		System.out.println("Result: " + result);
		
	}
	
}

make this thing go much, much faster by not being stupid.