Pagini recente » Cod sursa (job #2595457) | Cod sursa (job #729768) | Cod sursa (job #674309) | Cod sursa (job #1098837) | Cod sursa (job #41951)
Cod sursa(job #41951)
var n,i,j,k,s:longint;
f,g:text;
function ireductibil(x,y:longint):boolean;
var a,i:longint;
label 1;
begin
if (x=1) and (y=1) then begin
ireductibil:=true;
goto 1;
end;
if x>y then a:=x
else if y>x then a:=y
else if x=y then a:=x;
for i:=2 to a do if (x mod i=0) and (y mod i=0) then begin
ireductibil:=false;
goto 1;
end;
ireductibil:=true;
1:end;
begin
k:=0;
assign(f,'fractii.in');
reset(f);
readln(f,n);
close(f);
for i:=1 to n do
for j:=1 to n do begin
k:=k+1;
{v[k,1]:=i;
v[k,2]:=j;}
if ireductibil(i,j)=true then s:=s+1;
end;
{j:=0;
for i:=1 to k do begin
if ireductibil(v[i,1],v[i,2])=true then j:=j+1;
end;}
assign(g,'fractii.out');
rewrite(g);
writeln(g,s);
close(g);
end.