Help:=proc() : print( `IsConst(L),Di(L),IsPol(L) , GuessPol(L,x) `): end: #Di(L): the sequence of differences of consectutive entries of L #For example,Di([1,4,9]); should be [3,5]. Di:=proc(L) local i: [seq(L[i]-L[i-1],i=2..nops(L))]: end: #IsConst(L): is the sequence of numbers L a constant sequence: IsConst:=proc(L) evalb( nops(convert(L,set))<=1 ): end: #IsPol(L): inputs a list of length L and returns #a conjectured degree if it (conj.) a polynomial #and FAIL otherwise IsPol:=proc(L) local L1, k: L1:=L: for k from 1 to nops(L)-4 do L1:=Di(L1): if L1=[0$nops(L1)] then RETURN(k-1): fi: od: FAIL: end: #GuessPol(L,x): guesses a polynomial expression P(x) #such that P(i)=L[i] for all i between 1 and nops(L) GuessPol:=proc(L,x) local d,P,var, eq,a,i,c: d:=IsPol(L): if d=FAIL then RETURN(d): fi: P:=add( a[i]*x^i, i=0..d): var:={ seq( a[i], i=0..d)}: eq:={ seq( subs(x=c,P)=L[c], c=1..nops(L))}: var:=solve(eq,var): if var=NULL then RETURN(FAIL): fi: subs( var, P): end: