Pagini recente » Cod sursa (job #724125) | Cod sursa (job #2883610) | Cod sursa (job #2639273) | Cod sursa (job #2150002) | Cod sursa (job #688907)
Cod sursa(job #688907)
Program fractii;
var n,i,j,nr:longint;
f,g:text;
Function sim(x,y:longint):boolean;
var k:boolean;i:longint;
begin
k:=true;
if x<y then
for i:=2 to x do
begin
if (x mod i=0) and (y mod i=0) then k:=false;
end
else
for i:=2 to y do
begin
if (x mod i=0) and (y mod i=0) then k:=false;
end;
sim:=k;
end;
begin
assign(f,'fractii.in');
assign(g,'fractii.out');
reset(f);
rewrite(g);
while not eof(f) do
begin
read(f,n);
nr:=0;
for i:=1 to n do
begin
for j:=1 to i do
if sim(i,j) then
begin
inc(nr);
end;
end;
nr:=nr*2-1;
writeln(g,nr);
end;
close(f);close(g);
end.