Pagini recente » Cod sursa (job #1146426) | Cod sursa (job #2639710) | Cod sursa (job #2931535) | Cod sursa (job #789655) | Cod sursa (job #1261896)
program fractii;
var f,g:text;i,j,n,nr,x,y:longint;
begin
assign (f,'fractii.in'); reset (f);
assign (g,'fractii.out'); rewrite (g);
while not eof(f) do
begin
readln (f,n);
nr:=n;
for i:=2 to n do
for j:=1 to n do
begin
x:=i; y:=j;
while x<>y do
if x>y then x:=x-y
else y:=y-x;
if y=1 then nr:=nr+1;
end;
writeln (g,nr);
end;
close (f);
close (g);
end.