for loop increasing (Value) and decreasing (i) function

Just found out how great array with for loop is. it has saved many bytes of memory, and now I am rewriting everything with for loop code. Here I encounter a problem. I need to write a for loop, but I can't figure out a function to do so

for i= 5,4,3,2 // here is the for loop i: 5 to 2

x=(i-2); // this is easy, 5-2=3; 4-2=2.... etc
3,2,1,0

y=??? //but this???
4,7,10,13

/// here are some of my thinking or attempts, but they don't work; so my question: is there any tips for doing thing like this? and can someone solve this problem for me?

///////
-5+9=4;
-4+9+2=7
-3+9+4=10
-2+9+5=13

-5+10(2x5)-1=4
-4+12(2X6)-1=7
-3+14(2x7)-1=10
-2+16(2X8)-1=13

..put your number in a small array. Then use i, counting 0..3, as an index to the array

knut_ny:
..put your number in a small array. Then use i, counting 0..3, as an index to the array

thanks. I see, but the main reason for me to use array here is to save memory; if another array is added, wouldn't it be counterproductive here?

and can someone solve this problem for me?

If you want a for loop to create the output 4, 7, 10, 13 when i runs from 1 to 4, there seems to be nothing difficult about that:

for(int i=1; i<=4; i++)
{
   int j = i - 1 - 5; // j will be -5, -4, -3, -2
   int k = i + 4; // k will be 5, 6, 7, 8
   Serial.println(2*k + j - 1);
}

Of course, all the types could be byte. I think that the problem you are having is not seeing that you can introduce intermediate values in the loop. While they are not strictly necessary, it certainly makes it easier to decompose the problem.

for(int i=4;  i<=13;  i+=3)
{
   Serial.println(i);
}

or

  for(int i=5; i>=2; i--)
    Serial.println(3*(6-i)+1);