Re: recursion won't work for some reason

• To: mathgroup at smc.vnet.net
• Subject: [mg124828] Re: recursion won't work for some reason
• From: Bob Hanlon <hanlonr357 at gmail.com>
• Date: Wed, 8 Feb 2012 05:33:36 -0500 (EST)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• References: <201202070901.EAA23387@smc.vnet.net>

```Use Set ( = ) rather than Equal ( == ) to initialize the sequence.

Clear[a, n]

a[1] = 1; a[2] = 1; a[3] = 1; a[4] = 5; a[5] = 4; a[6] = 3;
a[7] = 25; a[8] = 23; a[9] = 22; a[10] = 149; a[11] = 130;
a[12] = 110;
a[n_Integer?Positive] :=
a[n] = 64*a[-12 + n] + 69*a[-9 + n] + 21*a[-6 + n] - a[-3 + n]

Table[a[n], {n, 1, 30}]

{1,1,1,5,4,3,25,23,22,149,130,110,785,693,623,4389,3880,3397,23977,21115,18684,131893,116502,102680,724705,638985,563949,3980357,3512812,3098935}

Bob Hanlon

On Tue, Feb 7, 2012 at 4:01 AM, Roger Bagula <roger.bagula at gmail.com> wrote:
> This recursion is translated from a FindSequenceFunction[]:
> won't work in version 8?
> Clear[a, n]
> a[1] == 1; a[2] == 1; a[3] == 1; a[4] == 5; a[5] == 4=
; a[6] == 3;
> a[7] == 25; a[8] == 23; a[9] == 22; a[10] == 149; a[11] =
== 130;
> a[12] == 110;
> a[n_] := a[n] =
>  64* a[-12 + n] + 69 *a[-9 + n] + 21 *a[-6 + n] - a[-3 + n]
> Table[a[n], {n, 1, 30}]
> I actually have hundreds like this that work with no problems...from
> version 5 and before.
> The FindSequenceFunction is:
> f[n_] = FindSequenceFunction[{1, 1, 1, 5, 4, 3, 25, 23, 22, 149, 130,
>   110, 785, 693, 623, 4389, 3880, 3397, 23977, 21115, 18684, 131893,
>   116502, 102680, 724705, 638985, 563949, 3980357, 3512812, 3098935,
>   21873593, 19295871, 17024690, 120159701, 106019274, 93536946,
>   660211505, 582473085, 513900795, 3627162981, 3200166736,
>   2823410521, 19928207945, 17582033699, 15512135608, 109487029365,
>   96597344158, 85225004732, 601533119489, 530715145745,
>   468234819865}, n]
> Table[f[n], {n, 1, 30}]
> {1, 1, 1, 5, 4, 3, 25, 23, 22, 149, 130, 110, 785, 693, 623, 4389,
> 3880, 3397, 23977, 21115, 18684, 131893, 116502, 102680, 724705,
> 638985, 563949, 3980357, 3512812, 3098935}
>
> The original sequence is a polynomial expansion:
> q[x_] = (-2 + 3 x - 8 x^3 + 8 x^4)
> f[x_] = ExpandAll[x^4*q[1/x]]
> a = Table[8^(1 + Floor[n/3])*SeriesCoefficient[
>          Series[1/f[x], {x, 0, 50}], n], {n, 0, 50}]
>
> Any help that you can give will be appreciated.
>

--
Bob Hanlon

```

• Prev by Date: Kolmogorov Smirnov in two or more dimensions
• Next by Date: Re: importing series of file with the same extension
• Previous by thread: recursion won't work for some reason
• Next by thread: Re: recursion won't work for some reason