i think this is what you're asking, i learned this in linear algebra. it's not the program but it's a method from which a program shouldn't be hard to come up with. i haven't done this in a while, and my notation is going to be messy.
you have a finite sequence of n elements A1, A2,...An. Then you consider them as ordered pairs (1,A1), (2,A2),...(n,An). To get a general n-1th degree polynomial
y = C1 + C2x +...+Cnx^(n-1) and then plug in some values and solve the linear equation.
to do your sequence for example 1,3,5,7. put them in ordered pairs (1,1) (2,3) (3,5) (4,7).
1 = C1 + C2(1) + C3(1) + C4(1)
3 = C1 + C2(2) + C3(4) + C4(8)
5 = C1 + C2(3) + C3(9) + C4(27
7 = C1 + C2(4) + C3(16) + C4(64)
4 equations, 4 unknowns, and i ended up with the polynomial
y = 2x - 1 x= 4,3,2,1.
just in case it isn't clear, Ck is the coefficient of x^(k-1).
if i understood, that's what you're looking for.