Pagini recente » Cod sursa (job #1104071) | Cod sursa (job #93713) | Cod sursa (job #1031775) | Rating UAIC-Tucar-Onesim-Vintur (UAIC_The_Robots) | Cod sursa (job #104785)
Cod sursa(job #104785)
{infoarena.ro fractii}
var f:text;
j,q:longint;
k,n:longint;
function ireductibile(x,y:longint):boolean;
var w,min:longint;
sem:boolean;
begin
sem:=true;
w:=2;
if x>y then min:=y
else min:=x;
if (x=y) and (x<>1) then
begin
sem:=false;
min:=0;
end;
if (x=1) and (y=1) then sem:=true;
while ((w<=min) 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.