f[x_, i_] := x^2 + i;

a = 1; n = 10;
For[x = a; i = 0, i < n + 1, i++, 
        x = f[x, i]];
Print[x]

a = 1; n = 10; x = a;
Do[x = f[x, i], {i, 0, n}];
Print[x]

a = 1; n = 10; x = a;
Table[x = f[x, i], {i, 0, n}]

a = 1; n = 10; x = a;
Print[ColumnForm[Table[x = f[x, i], {i, 0, n}]]]

Clear[n]

g[0] = 1;
g[1] = 1;
g[n_Integer] := g[n - 1] + g[n - 2]

g[2]

g[3]

g[4]

g[5]

g[20]

g[30]

Timing[g[30]]

Trace[g[5]]

Trace[g[8]]

h[0] = 1;
h[1] = 1;
h[n_Integer] := h[n] = h[n - 1] + h[n - 2]

h[10]

h[30]

h[100]

Trace[h[8]]

a = 1;
ex[0] = a; ex[n_] := ex[n - 1]^2 + n

ex[10]

ex[1]

x

x = 100

Module[{x}, a = 1; n = 10; 
      x = a; 
Do[
        x = f[x, i], {i, 0, n}]; 
Print[x]]

x

Clear[a]

f[a_, M_] := 
      Module[{x, n}, x = 1; n = 0; While[x > M, x = a x; n = n + 1]; 
        Return[n]]

f[3, 100]

Trace[f[3, 100]]

f[a_, M_] := 
      Module[{x, n}, x = 1; n = 0; 
        Do[If[x > M, Return[n]]; x = a x, {n, 0, 100}]]

f[3, 100]

Clear[f]; Clear[x, n]

f[x_, 0] = 1;
f[x_, n_] := (x + n - 1) f[x, n - 1]

Trace[f[0, 10]]

f[1, 10]

f[1/2, 10]

a = 1;
Table[a = 2 (1 + a)/(2 + a), {i, 1, 20}]

a = 1;
tab = Table[a = 2 (1 + a)/(2 + a), {i, 1, 20}]

N[tab, 20]