There's no need for an iterator in many such situations, especially as in this one where you're dealing with consecutive integers and individual functions (power-of-two and IntegerDigits
) are listable. To obtain the desired first digits, you may simply do this:
First /@ IntegerDigits[Range[20]^2]
(* {1, 4, 9, 1, 2, 3, 4, 6, 8, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 4} *)
If you want a table, you may use, for example:
{Range[20], First /@ IntegerDigits[Range[20]^2]} // TableForm