def recurrence_term(c, f):
 return sum(((c[i] * f.subs(n, (n + i))) for i in range(len(c))))

def recurrence_term ( c , f ) : return sum ( ( ( c [ i ] * f . subs ( n , ( n + i ) ) ) for i in range ( len ( c ) ) ) )
compute rhs of recurrence in f(n) with coefficients in c .