Pagini recente » Istoria paginii utilizator/floriamara | Cod sursa (job #2201802) | Rating Popescu Valentin (Ryuchetval) | Statistici Alexia Paunescu (AlexiaPaunescu1610) | Cod sursa (job #287791)
Cod sursa(job #287791)
var n,q,i,j,p,m:longint;f,g:text;
begin
assign(f,'fractii.in');reset(f);
assign(g,'fractii.out');rewrite(g);
readln(f,n);
q:=0;
for i:=1 to n do begin
for j:=1 to n do begin
m:=i;
p:=j;
while m<>p do begin
if m>p then m:=m-p
else p:=p-m;
end;
if m=1 then inc(q);
end;
end;
writeln(g,q);
close(f);
close(g);
end.