MathGroup Archive 2006

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

Search the Archive

Re: how to iterate


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