# Trouble with RecurrenceTable using elements from a previously computed list

When I use RecurrenceTable to solve a recursion relations, I encounter a problem, which is perhaps simple, but I do not understand why it is complaining. Here is a simple example. First, let's create a list

alist = Table[2^i, {i, 1, 100}]


and next evaluate

RecurrenceTable[{b[n] == alist[[n]] + b[n - 1], b[1] == 2}, b, {n, 1, 10}]


Then the results are

Part::pkspec1: The expression n cannot be used as a part specification. >>
Part::pkspec1: The expression 1+n cannot be used as a part specification. >>
Part::pkspec1: The expression 1+#1 cannot be used as a part specification. >>
General::stop: Further output of Part::pkspec1 will be suppressed during this calculation. >>

{2, 6, 14, 30, 62, 126, 254, 510, 1022, 2046}


Does anyone know where things go wrong and how to solve it?

In general I would like to know how to use the ReccurenceTable when the recursion relation depends on values from another precomputed list.

It appears that RecurrenceTable does some symbolic processing that leads to the unevaluated symbol n being given to Part as its 2nd argument. But Part only accepts integers as its 2nd argument. A work-around is:
Do[a[i] = 2^i, {i, 1, 10}]

{2, 6, 14, 30, 62, 126, 254, 510, 1022, 2046}
• @Wenzhe. What do you by "it has the same problem"?. There is no way my cod can produce an error message from Part. It make no use of Part. May 11, 2019 at 3:31