An arithmetic progression or sequence is a sequence of numbers such that the difference between the consecutive terms (d) is constant. In your case, difference is 3, and the first in the sequence is 1, and you want the first 1000 sequence numbers. Now, fit the formula for the arithmetic progression:
a+(n-1)*d
For your problem, you have the following:
a = 1;
d = 3;
Code for your solution (in Java) would be as follows:
public class ArithProg {
public static void main(String[] args) {
int a = 1;
int n = 1;
int d = 3;
while ( n <= 1000 ) {
System.out.println(a+(n-1)*d);
n++;
}
}
}
The advantage with this is that, you can change the value of 'a' as well as 'd', and get a sequence of n numbers in the arithmetic progression. Hope this helps.