MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: how to iterate

  • To: mathgroup at smc.vnet.net
  • Subject: [mg65980] Re: how to iterate
  • From: "Ray Koopman" <koopman at sfu.ca>
  • Date: Tue, 25 Apr 2006 05:19:17 -0400 (EDT)
  • References: <e2i987$9fc$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

vr wrote:
> 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.

In[1]:= Short@InputForm@
Nest[Append[#,(Plus@@Take[#,-2]+1)/#[[-3]]]&, {1,2,3}, 2003]

Out[1]//Short=
{1, 2, 3, 6, 5, 4, 5/3, 4/3, 1, 2, 3, <<1990>>, 2, 3, 6, 5, 4}

Remove the "Short@" to see all the terms.


  • Prev by Date: Re: A simple problem
  • Next by Date: Re: how to iterate
  • Previous by thread: Re: how to iterate
  • Next by thread: Re: how to iterate