This site is supported by donations to The OEIS Foundation.
User:Jean-François Alcover
Retired engineer, born 1947, Alma mater: Ecole Centrale Paris 1970.
Name: Jean-François Alcover
Location: Paris, France
E-mail: click here
Mathematica scripts for autosequences
firstKindQ[T_List] :=
Module[{ta, tb},
tb = Table[Sum[(-1)^(n-k)*Binomial[n, k]*Part[T,k+1],
{k, 0, Length[T] - 1}], {n, 0, Length[T]-1}];
ta = Table[(-1)^(n + 1) Part[T,n + 1], {n, 0, Length[T]-1}] ;
First[T] == 0 && ta == tb];
secondKindQ[T_List] :=
Module[{ta, tb},
tb = Table[Sum[(-1)^(n - k)*Binomial[n, k]*Part[T,k+1],
{k, 0, Length[T]-1}], {n, 0, Length[T]-1}];
ta = Table[(-1)^n Part[T,n+1], {n, 0, Length[T]-1}] ; ta == tb];
toSecondKind[T_?firstKindQ] :=
Table[2 Part[T,n+1] - Part[T,n], {n, 1, Length[T]-1}];
toFirstKind[T_?secondKindQ] :=
Table[1/2^n Sum[2^k Part[T,k+1], {k, 0, n-1}], {n, 0, Length[T]}];
autosequenceQ[T_List] := Which[
firstKindQ[T], Print["first kind, its second kind companion is ", toSecondKind[T]]; True,
secondKindQ[T], Print["second kind, its first kind companion is ", toFirstKind[T]]; True,
True, Print["not an autosequence"]; False];
Example:
autosequenceQ[Table[Fibonacci[n], {n, 0, 10}]]
first kind, its second kind companion is {2,1,3,4,7,11,18,29,47,76}