Pagini recente » Cod sursa (job #1605978) | Cod sursa (job #1846324) | Cod sursa (job #2811161) | Cod sursa (job #349799) | Cod sursa (job #302360)
Cod sursa(job #302360)
var i,n,j,a,b,cn,r:longint;
f,g:text;
begin
assign(f,'fractii.in');
assign(g,'fractii.out');
reset(f);
rewrite(g);
readln(f,n);
cn:=n;
for i:=1 to n do
for j:=1 to n do
begin
if (i>=2) and (i<>j) then
begin
a:=i;
b:=j;
while a mod b<>0 do
begin
r:=a mod b;
a:=b;
b:=r;
end;
if b=1 then inc(cn);
end;
end;
write(g,cn);
close(f);
close(g);
end.