Pagini recente » Cod sursa (job #2979658) | Cod sursa (job #1156489) | Cod sursa (job #237071) | Cod sursa (job #173223) | Cod sursa (job #287799)
Cod sursa(job #287799)
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
if i mod j=0 then 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
else inc(q);
end;
end;
writeln(g,q);
close(f);
close(g);
end.