# Using Table to iterate over two lists element by element instead of as a matrix

So I have two lists generated in the following fashion, I don’t know if it’s the most efficent way to get these, but that’s beside the point right now.

``````Nlayer = 6;
n = 0;
layernumber = Table(n = n + (Mod(i, 2)), {i, 1, 2*Nlayer})
n = 1;
interfacenumber = Table(n = n + (Mod(i, 2)), {i, 0, 2*Nlayer-1})
``````

Which returns:

``````{1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6}

{1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7}
``````

And I’m trying to get the Table function to apply the i-th value of each list to two different functions X and Y, getting a list of the same length as above. What I have right now is the following (which is incorrect, it returns a 12×12 matrix instead of a 1×12 table):

``````Table(X(i)*Y(j), {i,layernumber}, {j,interfacenumber});
``````

In other words, I want it to return the 12 values that would be computed below into a list. Later, this will be expanded well beyond 12 values and I want to just expand the initial list instead of typing this out many more times.

``````X(1)*Y(1)
X(1)*Y(2)
X(2)*Y(2)
X(2)*Y(3)
X(3)*Y(3)
X(3)*Y(4)
X(4)*Y(4)
X(4)*Y(5)
X(5)*Y(5)
X(5)*Y(6)
X(6)*Y(6)
X(6)*Y(7)
``````