Pagini recente » Cod sursa (job #2291016) | Cod sursa (job #2224021) | Cod sursa (job #266468) | Cod sursa (job #2277921) | Cod sursa (job #584625)
Cod sursa(job #584625)
var n,i,j,fr,a,b,r:longint;
begin
assign(input,'fractii.in');reset(input);
assign(output,'fractii.out');rewrite(output);
read(n);
i:=0;
j:=0;
a:=0;
b:=0;
r:=0;
fr:=n;
for i:=2 to n do
for j:=1 to n do begin
if j=1 then inc(fr)
else begin
a:=i;
b:=j;
while a mod b<>0 do begin
r:=a mod b;
a:=b;
b:=r;
end;
if b=1 then inc(fr);
end;
end;
write(fr);
close(output);
end.