Cod sursa(job #584623)
Utilizator | Data | 26 aprilie 2011 10:33:22 | |
---|---|---|---|
Problema | Fractii | Scor | 10 |
Compilator | fpc | Status | done |
Runda | Arhiva de probleme | Marime | 0.35 kb |
var n,i,j,fr,a,b,r:longint;
begin
assign(input,'fractii.in');reset(input);
assign(output,'fractii.out');rewrite(output);
read(n);
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);
end.