Pagini recente » Cod sursa (job #1060486) | Cod sursa (job #3152012) | Cod sursa (job #2748570) | Cod sursa (job #3220757) | Cod sursa (job #129934)
Cod sursa(job #129934)
program fractii;
var f,g:text;
n,i,j,ci,cj:longint;
c:int64;
begin
assign(f,'fractii.in');
assign(g,'fractii.out');
reset(f);
rewrite(g);
read(f,n);
for i:=1 to n do
begin
for j:=1 to n do
begin
ci:=i;
cj:=j;
while (ci<>cj)do
if (ci>cj)then ci:=ci-cj else cj:=cj-ci;
if (ci=1)then c:=c+1;
end;
end;
writeln(g,c);
close(f);
close(g);
end.