Cod sursa(job #218692)
Utilizator | Data | 3 noiembrie 2008 08:43:17 | |
---|---|---|---|
Problema | Fractii | Scor | 10 |
Compilator | fpc | Status | done |
Runda | Arhiva de probleme | Marime | 0.5 kb |
var f,g:text;
u,v,j,i,r,nr,n: longint;
begin
assign(f,'fractii.in');reset(f);
assign(g,'fractii.out');rewrite(g);
readln(f,n);
nr:=1;
for i:=1 to n-1 do
for j:=i+1 to n do
begin
u:=i;
v:=j;
repeat
r:=u mod v;
u:=v;
v:=r;
until r=0;
if u=1 then nr:=nr+2;
end;
writeln(g,nr);
close(g);
end.