Pagini recente » Cod sursa (job #1709012) | Cod sursa (job #733318) | Cod sursa (job #558068) | Cod sursa (job #2489600) | Cod sursa (job #308896)
Cod sursa(job #308896)
Program fractii;
var n,i,j,k: longint;
f,g : text;
function max(a,b : longint) : longint;
begin
if a>b then max:=a else max:=b;
end;
function min(a,b : longint) : longint;
begin
if a<b then min:=a else min:=b;
end;
function ireductibil(i,j : longint) : boolean;
var a:longint;
begin
ireductibil:=true;
if (i=1) and (j=1) then exit(true);
if (i<>1) and (j=1) then exit(true);
for a:=2 to max(i,j) do
if (i mod a=0) and (j mod a=0) then exit(false);
end;
begin
assign(f,'fractii.in');
reset(f);
readln(f,n);
close(f);
k:=0;
for i:=1 to n do
for j:=1 to n do
if ireductibil(i,j) then k:=k+1;
assign(g,'fractii.out');
rewrite(g);
writeln(g,k);
close(g);
end.