[seqfan] Re: Integer Sequence Analysis in Mathematica 7

Eric W. Weisstein eww at wolfram.com
Sat Nov 22 02:45:24 CET 2008


On Fri, 21 Nov 2008, Maximilian Hasler wrote:

> On Fri, Nov 21, 2008 at 8:09 PM, Alexander Povolotsky
> <apovolot at gmail.com> wrote:
>> Could you if it is allowed  (just to get a real "by example" feel of
>> those new exciting  Mathematica 7 capabilities) show us what close
>> formula is suggested by Mathematica 7 for
>> A001609                  a(n) = a(n-1) + a(n-3).
>>        1, 1, 4, 5, 6, 10, 15, 21, 31, 46, 67, 98, 144, 211, 309, 453, 664,
>> 973, 1426, 2090, 3063, 4489, 6579, 9642, 14131, 20710, 30352, 44483,
>> 65193, 95545, 140028, 205221, 300766, 440794, 646015, 946781, 1387575,
>> 2033590, 2980371, 4367946, 6401536, 9381907
>
>
> I don't think you need M-- (I like the minuses ;-P) for this:
>
> ggf(v)={    local( p,q,B=#v\2 );    B<4 & return;
>    if( !#q = qflll( matrix(B, B, x, y, v[x-y+B+1]), 4)[1], return);
>    if ( polcoeff( p = Ser( q[,1] ), 0 )<0, p=-p );
>    q = Pol( Ser( v )*p );    if( Ser(v) == q /= Pol(p), q)
> }

In Mathematica 7, it would look something like this:

seq = {1, 1, 4, ...};

FindSequenceFunction[seq][n]
Root[-1 - #1^2 + #1^3 &, 1]^n + Root[-1 - #1^2 + #1^3 &, 2]^n + Root[-1 - #1^2 + #1^3 &, 3]^n

(* or *)

FindGeneratingFunction[seq, x]
(1 + 3 x^2)/(1 - x - x^3)

FullSimplify[SeriesCoefficient[%, {x, 0, n - 1}], n >= 1]
Root[-1 - #1^2 + #1^3 &, 1]^n + Root[-1 - #1^2 + #1^3 &, 2]^n + Root[-1 - #1^2 + #1^3 &, 3]^n

Table[%, {n, 20}] // FullSimplify
{1, 1, 4, 5, 6, 10, 15, 21, 31, 46, 67, 98, 144, 211, 309, 453, 664, 973, 1426, 2090}

(* or *)

FindLinearRecurrence[seq]
{1, 0, 1}

LinearRecurrence[%, {1, 1, 4}, 20]
Out[83]= {1, 1, 4, 5, 6, 10, 15, 21, 31, 46, 67, 98, 144, 211, 309, 453, 664, 973, 1426, 2090}


Have a nice weekend, all,
-Eric




More information about the SeqFan mailing list