Here is another way to see this. We'll use Trace
(which is a very useful function to understand what's going inside during the expression evaluation - I highly recommend reading the help page and getting familiar with it), and // Column
at the end just prints resulting list one element on a line.
Trace[NestList[2 # &, 2, 5]] // Column
The first line is just the expression we are evaluating. Each of the next 5 lines corresponds to one application of the pure function inside your NestList
(since the third argument of NestList
is 5), starting from 2 (the second argument to NestList
), and applying the function to each consecutive result.
Finally, the last line is the output - as Rohit pointed out, 2, which is the starting number, is also added to the list.