Pagini recente » Cod sursa (job #165243) | Cod sursa (job #1203174) | Cod sursa (job #430404) | Cod sursa (job #838719) | Cod sursa (job #600960)
Cod sursa(job #600960)
var N,i,j,NR:longint; F:text;
function CMMDC(a,b:longint):longint;
begin
while (a<>0) and (b<>0) do
if a>b then a:=a-b else b:=b-a;
CMMDC:=a;
end;
Begin
assign(F, 'fractii.in');
reset(F);
readln(F, N);
close(F);
assign(F, 'fractii.out');
rewrite(F);
nr:=N*N;
for i:=2 to N do
for j:=2 to N do
if CMMDC(i,j)>1 then
nr:=nr-1;
writeln(F, NR);
close(F);
end.