Wolfram Daily Study Group Exercise: squared function?

I’m a beginner hobbyist., Can someone please explain why this is a squared function?

IN: NestList[2 # &, 2, 5]
OUT: {2, 4, 8, 16, 32, 64}

Since it is a nestlist, the function is applied from 0 to 5, but what makes it a power function and why doesn’t the result start with 1 (2^0) ?

Thanks very much,
Andrew Skipor

NestList always returns the second argument as the result of iteration 0, The return values are powers of two because the previous value is multiplied by 2 in each nest.

{2, 2*2, 2*2*2, 2*2*2*2 ...}

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.

Thanks very much, This is very helpful.
Andrew Skipor