.


- 6


. n. a b, n, .. :

1 ...? . n, .

, , a

, :

, b 1. , , a , , .

:

a := 1; k := 1;

while a*a + 1<=n do

begin

k := k + 1;

a := a + 1

end;

 

, , 1 k:

for a := 1 to

k do

b. 1 k, , , , 20 :

22 + 42

= 20 42 + 22 = 20.

, b 1 a, k .

.

Procedure

to_square(n : integer);

label 1;

var

a, b, k : integer;

begin

a := 1; k := 1;

while a*a + 1<=n do

begin

k := k + 1;

a := a + 1

end;

for a := 1 to k do

for b := 1 to a do

if a*a + b*b = n

then

begin

writeln(n, '=', a, '*', a,' +', b, '*', b); goto

1

end;