Pagini recente » Cod sursa (job #2456521) | Cod sursa (job #3285030) | Cod sursa (job #3256301) | Cod sursa (job #459054) | Cod sursa (job #16178)
Cod sursa(job #16178)
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:=0;
for i:=1 to n do
for j:=1 to i do
if cmmdc(i,j)=1 then
inc(s,2);
writeln(g,s-1);
close(g); close(f);
end.