Directly going to the issue, my problem is how to use a RecurrenceTable
when it have inputs from a vector defined previously. For instance I have:
p={1,10,100,1000,10000};
And the recursive relation I want to solve is:
RecurrenceTable[{a[n + 1] == 2 a[n] + p[[n]], a[1] == 1}, a, {n, 1, 5}]
which must have an answer as:
{1,3,16,132,1264}
But I face with this error:
Part::pkspec1: The expression n cannot be used as a part specification.
Part::pkspec1: The expression #1 cannot be used as a part specification.
For avoiding part specification I tried the following:
z = 1;
RecurrenceTable[{a[n + 1] == 2 a[n] + p[[z++]], a[1] == 1}, a, {n, 1, 5}]
But the answer is wrong:
{1, 3, 7, 15, 31}