Pagini recente » Cod sursa (job #170367) | Cod sursa (job #172174) | Cod sursa (job #2220391) | Cod sursa (job #2901295) | Cod sursa (job #170928)
Cod sursa(job #170928)
var
f:text;
n,p,q,k:longint;
function ire(x,y:longint):longint;
begin
if x mod y=0 then ire:=y
else
ire:=ire(y,x mod y);
end;
begin
assign(f,'fractii.in');
reset(f);
readln(f,n);
close(f);}
{randomize;
n:=random(9999)+1 ;}
{n:=1000000;}
assign(f,'fractii.out');
rewrite(f); k:=2*n-1;
for p:=2 to n do
for q:=2 to n do
begin
if ire(p,q)=1 then inc(K);
end;
write(f,k);
close(f);
end.