This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

NestList

NestList
gives a list of the results of applying f to expr through n times.
The function to nest can be a pure function:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
 
The function to nest can be a pure function:
In[1]:=
Click for copyable input
Out[1]=
Nesting a function can build a formula:
Nesting can return a single number:
The nested function can operate on a list:
To nest a function of more than one argument, the arguments can be put into a list:
Powers of 2:
Successive integers:
Successive squaring:
Growth of annually compounded capital:
Successive derivatives:
Newton iterations for :
Continued fraction:
Iterated map:
Iterates in the problem:
Linear congruential pseudorandom generator:
Random walk:
Iterated string replacements:
Successively append to a list:
Successively rotate a list:
Operations on a pair of values:
Nest gives the last element of NestList:
Nesting zero times simply returns to the original argument:
FixedPointList goes on until the result no longer changes:
NestWhileList goes on while a condition is true:
FoldList automatically inserts second arguments from a list:
Power towers:
New in 1