Pagini recente » Istoria paginii utilizator/stargold2 | Diferente pentru home intre reviziile 369 si 902 | Diferente pentru home intre reviziile 533 si 902 | Diferente pentru home intre reviziile 96 si 97 | Cod sursa (job #202589)
Cod sursa(job #202589)
program p_003;{fractii}
var n,p,q,nr,r,p1,q1:longint;
begin
assign(input,'fractii.in'); reset(input);
assign(output,'fractii.out'); rewrite(output);
readln(n);
nr:=n;
for p:=2 to n do begin
nr:=nr+1;
for q:=2 to n do begin
if p<>q then begin
p1:=p; q1:=q;
r:=p1 mod q1;
while r<>0 do begin
p1:=q1; q1:=r; r:=p1 mod q1;
end;
if q1=1 then nr:=nr+1;
end;
end;
end;
write(nr);
close(input); close(output);
end.