I'm Dumb let's face it, My Brains fried for finals, We have this little baby problem and I can't figure it out, Here is the example

All you have to do is find the value of Y on the 1,000th repetition 'Y=X^3-(X+Y)' start with Y=1, X=1 then increment X and keep recalculating Y until X reaches 1,000

If you're lost you need to do something like this:
set X to 1
set Y to 1
repeat this until X is greater than 1000
set Y to X^3 - (X + (the old value of Y))
increase X by 1
end of the repeated bit
print X and Y


This is what I have, I guess it's wrong cause were supposed to submit the answer and I get the wrong one, Anyone tell me what i'm doing wrong or supply the correct answer, I get = -37390? ANyone else get the same thing or something different, Please help.



public class test1 {

public static void main(String[] args) {

int y = 1;
int x;
for (x = 1;x < 1000; x ++)
y = x ^ 3 - (x + y );
System.out.println("Value of X" + x);
System.out.println("Value of y" + y);
}
}