.


- 5


Program Succession; { succession - }

uses WinCrt;

var

a, i, n : integer;

{----------------------------------------------------------------------------------------}

Function Sum(a: integer): integer;

var

s: integer;

begin

s:=0;

repeat

s := s + a mod 10;

a := a div 10

until a = 0;

Sum := s

end;

{----------------------------------------------------------------------------------------}

Function Succ(n : integer): integer;

var

a, i : integer;

begin

a := 7;

for i := 2 to n do

a := Sum(a*a) + 1;

Succ := a

end;

{----------------------------------------------------------------------------------------}

begin

write(' ');

readln(n);

for i := 1 to n do write(Succ(i), ' ');

writeln

end.