Pagini recente » Cod sursa (job #2908924) | Cod sursa (job #2426808) | Cod sursa (job #2410924) | Cod sursa (job #726108) | Cod sursa (job #16179)
Cod sursa(job #16179)
var n:longint;
a:array[1..1000000] of boolean;
s,i,j:longint;
f,g:text;
function cmmdc(x,y:longint):longint;
begin
while x<>y do
if y>x then
y:=y-x
else
x:=x-y;
cmmdc:=x;
end;
begin
assign(f,'fractii.in'); reset(f);
assign(g,'fractii.out'); rewrite(g);
readln(f,n);
s:=1;
for i:=2 to n do
for j:=1 to i do
if cmmdc(i,j)=1 then
inc(s,2);
writeln(g,s);
close(g); close(f);
end.