Pagini recente » Cod sursa (job #1464083) | Cod sursa (job #1535566) | Cod sursa (job #2813080) | Cod sursa (job #2937584) | Cod sursa (job #104741)
Cod sursa(job #104741)
{infoarena.ro fractii}
var f:text;
j,q:longint;
k,n:longint;
function ireductibile(x,y:longint):boolean;
var w:longint;
sem:boolean;
begin
sem:=true;
w:=2;
while ((w<=x) and sem) do
begin
if (x mod w=0) and (y mod w=0) then sem:=false;
w:=w+1;
end;
ireductibile:=sem;
end;
begin
assign (f,'fractii.in');
reset (f);
readln (f,n);
close (f);
assign (f,'fractii.out');
rewrite (f);
k:=0;
for j:=1 to n do
for q:=1 to n do
if ireductibile(j,q) then k:=k+1;
writeln(f,k);
close (f);
end.