finished problem

changed for loop to end when the number is gets greater than 1 million;
note: took ~5 minutes to run