Pagini recente » Cod sursa (job #1303750) | Cod sursa (job #210030) | Cod sursa (job #211653) | Cod sursa (job #210323) | Cod sursa (job #2030)
Cod sursa(job #2030)
program fractii;
var n,k,i,j,r,a,b:longint;f1,f2:text;
begin
assign(f1,'fractii.in');
reset(f1);
read(f1,n);
close(f1);
k:=0;
for i:=1 to n do
for j:=1 to n do
if (i=j)and(i=1)then k:=k+1 else
if (i<3)and(j<3)and(i<>j)then k:=k+1 else
if (i mod 2=0)and(j mod 2=0)then k:=k else
if (i mod 3=0)and(j mod 3=0)then k:=k else
if (i mod 5=0)and(j mod 5=0)then k:=k else
begin
a:=i;
b:=j ;
repeat
r:=a mod b;
a:=b;
b:=r;
until r=0;
if a=1 then k:=k+1;
end;
assign(f2,'fractii.out') ;
rewrite(f2);
write(f2,k);
close(f2);
end.