Cod sursa(job #218465)

Utilizator sandu2508Grigoroi Alexandru sandu2508 Data 2 noiembrie 2008 10:42:04
Problema Fractii Scor 10
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.48 kb
program fractii;

label
 001;

var
 a, b, i, j, n: longint;
 f: text;

begin
 assign (f, 'fractii.in');
 reset(F);
 readln(f, n);
 close(F);
 b:=0;
 for i:=2 to n do
  for j:=i to n do
   begin
    if j mod i = 0 then
     goto 001;
    for a:= 2 to (i div 2) do
     if i mod a = 0 then
      if j mod a = 0 then
       goto 001;
    b:=b+2;
    001:;
   end;
   b:=b-1;
   b:=b+2*n;
  assign(f, 'fractii.out');
  rewrite(f);
  writeln(f, b);
  close(f);
 end.