Pagini recente » Cod sursa (job #2805420) | Cod sursa (job #1146829) | Cod sursa (job #2424801) | Cod sursa (job #921960) | Cod sursa (job #624082)
Cod sursa(job #624082)
var f:text;
i,j,n,nr:longint;
function ok(i,j:longint):longint;
begin
if i<>j then
repeat
if i>j then i:=i-j
else j:=j-i;
until i=j;
ok:=i;
end;
begin
assign(f,'fractii.in');
reset(f);
read(f,n);
close(f);
nr:=2*n-1;
assign(f,'fractii.out');
rewrite(f);
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(f,nr);
close(f);
end.