Pagini recente » Cod sursa (job #863663) | Cod sursa (job #6489) | Cod sursa (job #2302679) | Cod sursa (job #28247) | Cod sursa (job #624064)
Cod sursa(job #624064)
var f,g:text;
i,j,n,nr:longint;
function ok(i,j:longint):integer;
var c :longint;
begin
{if i<>j then
repeat
if i>j then i:=i-j
else j:=j-i;
until i=j;
ok:=i;}
while j<>0 do
begin
c:=i mod j;
i:=j;
j:=c;
end;
ok:=i;
end;
begin
assign(f,'fractii.in');
reset(f);
assign(g,'fractii.out');
rewrite(g);
read(f,n);
nr:=2*n-1;
for i:= 2 to n do
for j:= 2 to n do
if i<>j then
if (i mod 2<>0) or (j mod 2<>0) then
if ok(i,j)=1 then nr:=nr+1;
write(g,nr);
close(f);
close(g);
end.