
Loop invariants
Consider the following while loop:
n:=1
while n<b, do
print n
n:=4n2
a.) Write the first three numbers printed;
b.) Find all values of b for which the last number printed will be 342.
I am at a complete loss as to how to figure this out. I feel like just plugging in 1 for n is far too easy, and if that is the case, it will take far too long to get to 342.

1)
n:=1
while n<b, do
print n
n:=4n2
2)
n:=4(1)2 = 2
while n<b, do
print n
n:=4n2
3)
n:=4(2)2 = 6
while n<b, do
print n
n:=4n2
Output will be 1,2,6
Also
n : 1, 2, 6, 22, 86
4n2: 2, 6, 22, 86, 342