MathGroup Archive 2002

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

Search the Archive

Re: NestWhile

  • To: mathgroup at smc.vnet.net
  • Subject: [mg32537] Re: [mg32519] NestWhile
  • From: Mianlai Zhou <lailai at nikhef.nl>
  • Date: Sat, 26 Jan 2002 04:07:55 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

NestWhileList[f, 7, # != 1 &]

will work. Good luck!

Mianlai Zhou
Theory Group, NIKHEF
Amsterdam, the Netherlands

On Fri, 25 Jan 2002, Tom De Vries wrote:

> Hello!
> 
> I know this is a simple question, hope someone can help me out.....
> 
> If I define the function
> 
> f[n_] := If[EvenQ[n], n/2, 3n + 1]
> 
> 
> I can then apply NestList and generate a nice number loop......
> 
> NestList[f, 7, 23]
> 
> I want to use NestWhileList and stop when the generated number is a 1.  How
> do I do that?
> 
> Thanks for the help,
> 
> Sincerely,
> 
> Tom De Vries 
> 
> 



  • Prev by Date: Trivial changes to formula
  • Next by Date: Headless set of elements?
  • Previous by thread: RE: NestWhile
  • Next by thread: Re: NestWhile