Cod sursa(job #146601)
Utilizator | Data | 1 martie 2008 22:14:34 | |
---|---|---|---|
Problema | Fractii | Scor | 10 |
Compilator | fpc | Status | done |
Runda | Arhiva de probleme | Marime | 0.54 kb |
var n,i,j,x,y,nr,r:longint;
begin
assign (input,'fractii.in');
reset (input);
assign (output,'fractii.out');
rewrite (output);
readln (n);
nr:=n;
for i:=2 to n do
for j:=1 to n do
begin
if j=1 then inc (nr)
else begin
x:=i;
y:=j;
while y<>0 do
begin
r:=x mod y;
x:=y;
y:=r;
end;
if x=1 then inc(nr);
end;
end;
writeln (nr);
end.