Pagini recente » Cod sursa (job #907006) | Cod sursa (job #2200732) | Cod sursa (job #772972) | Cod sursa (job #977463) | Cod sursa (job #572010)
Cod sursa(job #572010)
program fractii;
var n,i,j,x:longint;
d,o:text;
function cmmdc(a,b:longint):longint;
begin
while a<>b do
if a<b then repeat b:=b-a until b<=a
else repeat a:=a-b until a<=b;
cmmdc:=a;
end;
begin
assign(d,'fractii.in');assign(o,'fractii.out');
reset(d);rewrite(o);
read(d,n);
x:=0;
for i:=1 to n do
for j:=1 to n do
if cmmdc(i,j)=1 then x:=x+1;
writeln(o,x);
close(d);
close(o);
end.