Pagini recente » Cod sursa (job #3156723) | Cod sursa (job #919227) | Cod sursa (job #2228132) | Cod sursa (job #2521441) | Cod sursa (job #696)
Cod sursa(job #696)
var f:text;
n,s,i,j,a,b,c:longint;
begin
assign(f,'fractii.in');
reset(f);
read(f,n);
close(f);
s:=2*n-1;
for i:=2 to n do
for j:=2 to n do
begin
if (i mod 2=0)and(j mod 2=0) then
else
if (i mod 3=0)and(j mod 3=0) then
else
if (i mod 5=0)and(j mod 5=0) then
else
begin
a:=i;
b:=j;
while (a<>0)and(b<>0)do
begin
c:=b;
b:=a mod b;
a:=c;
end;
if a+b=1 then
inc(s);
end;
end;
assign(f,'fractii.out');
rewrite(f);
write(f,s);
close(f);
end.