Pagini recente » Cod sursa (job #930910) | Cod sursa (job #1231766) | Cod sursa (job #1610739) | Cod sursa (job #3235090) | Cod sursa (job #256608)
Cod sursa(job #256608)
program fractie;
var i,j,n,t,l:integer;
f:text;
function divizor(x,y:integer):boolean;
var i,o:integer;
label 1;
begin
divizor:=false;
if x<y then begin o:=x; x:=y; y:=o; end;
for i:=y downto 2 do
if (x mod i=0)and(y mod i=0) then
begin divizor:=true; goto 1; end
else divizor:=false;
1:end;
begin
assign(f,'fractii.in');
reset(f);
readln(f,n);
close(f);
assign(f,'fractii.out');
rewrite(f); t:=n*n;
l:=0;
for i:=2 to n do
for j:=1 to n do
begin
if (i>1)and(j>1) then if divizor(i,j) then inc(l);
end;
t:=t-l;
writeln(f,t);
close(f);
end.