function gcd (A,B: longint): longint;
begin
while (A <> B) do
begin
if (A > B) then
Dec(A, B)
else
Dec(B, A);
end;
gcd := A;
end;
var
N: longint;
I,A: longint;
begin
WriteLn ('Input N: ');
ReadLn (N);
A := 0;
for I := 1 to N-1 do
if (gcd(I, N) = 1) then
Inc (A);
WriteLn ('The Euler Function of N is: ', A);
ReadLn;
end.
Немає коментарів:
Дописати коментар