Pagini recente » Cod sursa (job #1224665) | Cod sursa (job #2803837) | Cod sursa (job #2114888) | Cod sursa (job #2581174) | Cod sursa (job #104742)
Cod sursa(job #104742)
{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.