program b2 var integer recursivnaya function integer integer begin if

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
program b2;
var n, x: integer;
{recursivnaya}
function t(n, x:integer): integer;
begin
if (n = 0) then t := 1 else
if (n = 1) then t := x else
t := 2*x* t(n-1, x) - t(n-2, x);
end;
{nerecursivnaya}
function t_s(n, x: integer): integer;
var i,j,k,l,m,s : integer;
begin
k:= 1; l:= x;
for i:= 2 to n do begin
s := 2*x * l - k; k:= l; l:= s;
end;
t_s := s;
end;
begin
write('vvedite n, x: '); readln(n, x);
writeln('recur T(n, x): ', t(n,x));
writeln('simple T(n, x): ', t_s(n,x));
readln;
end.