Cod sursa(job #29694)

Utilizator thejudgerThe Judger thejudger Data 9 martie 2007 19:41:38
Problema Fractii Scor 10
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.51 kb
var f,g:text;
    n,i,j,a,b,k:longint;
begin
assign(f,'fractii.in');reset(f);
assign(g,'fractii.out');rewrite(g);
readln(f,n);
repeat
inc(i);
for j:=1 to n do
              begin
              a:=i;
              b:=j;
              while a<>b do
                         begin
                         if a>b then a:=a-b;
                         if b>a then b:=b-a;
                         end;
              if a=1 then inc(k);
              end;
until i=n;
writeln(g,k);
close(f);
close(g);
end.