Re: how to iterate

• To: mathgroup at smc.vnet.net
• Subject: [mg65971] Re: [mg65948] how to iterate
• From: "Owen, HL \(Hywel\)" <h.l.owen at dl.ac.uk>
• Date: Tue, 25 Apr 2006 05:18:46 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```You're almost there. You just need to be aware that Mathematica makes
the important distinction between (...) which is for grouping terms and
expressions, and [...] which is for functional definitions.

f[1]=1;
f[2]=2;
f[3]=3;

Then the other numbers are defined using:

f[n_] := (f[n - 1] + f[n - 2] + 1)/f[n - 3]

e.g. f[22] is 4

Table[f[n], {n, 4, 25}] gives f[4] up to f[25].

This method is not quick but teaches a bit how Mathematica does things.
I think that

Table[f[n], {n, 4, 2006}]

will take some time to calculate.

> -----Original Message-----
> From: vr [mailto:valentino.rossi.85 at gmail.com]
To: mathgroup at smc.vnet.net
> Subject: [mg65971] [mg65948] how to iterate
>
> hi all,
>
> pls excuse my ignorance. i'm still new to mathematica, and i
> forgot much of what i had learned.
>
> how can i list the output of the function below for n=4..2006?
> f(n) = ( f(n-1) + f(n-2) + 1 ) / f(n-3)
> given f(1)=1, f(2)=2, f(3)=3.
>
> thanks for any help in advance.
>
>
>

```

• Prev by Date: error function
• Next by Date: Re: how to iterate
• Previous by thread: Re: how to iterate
• Next by thread: Re: how to iterate