# Recursive sequence with RecurenceTable

I want to compute elements of a recursive sequence and use them as coefficients of a power series. However, the (i+1)-th element depends on all previous elements. Writing this as a sum in RecurrenceTable doesn't work. d[l] is a regularly defined function.

RecurrenceTable[{c[i + 1] == 1/((i + 1) d[0]) Sum[(l (5 + 1) - (i + 1))
d[l] c[i + 1 - l], {l, 1,
i + 1}] , c[1] == d[0]^5}, c, {i, 1, 10}]

The code needs to be adjusted so that RecurrenceTable understands that the c[l] in the Sum are the ones to be used for the recursion relation. This error shows up:

All arguments in position 1 of c[1+i]==\!$$\*UnderoverscriptBox[\(\ [Sum]$$, $$l = 1$$, $$1 + i$$]$$\((\(-1$$ - i + 6\ l)\)\ c[1 + i -
l]\)\)/(1+i) should be in the form i + integer.

Can I do this with RecurrenceTable or do I need to write a brute force code that computes the sequence?

• There seems to be something wrong, since for each sum you need c[0], which is not defined. Other than that I think it would be easier to just use normal definitions to get the sequence. Dec 16, 2020 at 13:38

RecurrenceTable probably isn't the right tool for this. An alternative approach is to define it recursively:

Clear[c, d];
d[l_] := l^2 + 1;
c[0] = d[1]^5;
c[i_] := c[i] = 1/(i d[0]) Sum[(l 5 - i) d[l] c[i - l], {l, 1, i}]

You can then access the values by entering c[1] or c[5], or get a range of values with

c /@ Range[10]

You didn't specify the function d[] so I just used a quadratic, added an initial condition for c[0], and moved the indices back by 1.

Using the definitions given in answer by bill s

Clear["Global`*"]

Clear[c, d];
d[l_] := l^2 + 1;
c[0] = d[1]^5;
c[i_] := c[i] = 1/(i d[0]) Sum[(l 5 - i) d[l] c[i - l], {l, 1, i}]

Generating a longer sequence

seq = c /@ Range[15]

(* {256, 1408, 6144, 22848, 75264, 224896, 619520, 1591904, 3849984, 8825856, \
19289088, 40383616, 81320960, 158060288, 297433088} *)

Using FindSequenceFunction to generalize from the sequence

f[n_] = FindSequenceFunction[seq, n]

(* (1/155925)2 (2494800 + 5899860 n + 5965740 n^2 + 3700631 n^3 + 1434510 n^4 +
365420 n^5 + 83160 n^6 + 13068 n^7 + 990 n^8 + 220 n^9 + n^11) *)

Verifying equivalence outside the original sequence

And @@ Table[c[i] == f[i], {i, 16, 50}]

(* True *)