Pagini recente » Cod sursa (job #128831) | Statistici Cineva (altcinava3322) | Cod sursa (job #1633648) | Cod sursa (job #86592) | Cod sursa (job #1816964)
Program Fractii;
VAR
f,g : Text;
i,j,db,n : Integer;
Function Irreducibilis(x,y : LongInt) : Boolean;
BEGIN
If i > j then
If i mod j = 0 then Irreducibilis := FALSE
else Irreducibilis := TRUE;
If i < j then
If j mod i = 0 then Irreducibilis := FALSE
else Irreducibilis := TRUE;
If i = j then Irreducibilis := FALSE;
If (i>j) and (j=1) then Irreducibilis := TRUE;
if (i<j) and (i=1) then Irreducibilis := TRUE;
If (i=1) and (j=1) then Irreducibilis := TRUE;
END;
BEGIN
Assign(f,'fractii.in'); Reset(f);
Assign(g,'fractii.out'); Rewrite(g);
Read(f,n);
db:=0;
For i:=1 to n do
For j:=1 to n do
begin
If Irreducibilis(i,j) then Inc(db);
end;
Write(g,db);
Close(f); Close(g);
END.