Pagini recente » Cod sursa (job #714600) | Cod sursa (job #911902) | Cod sursa (job #2909709) | Cod sursa (job #2972537) | Cod sursa (job #86810)
Cod sursa(job #86810)
Var a:array [1..1000000] of integer;
f,g:text;
n,i,suma,jk,coef,j:longint;
ok:boolean;
Begin
assign (f,'fractii.in');
assign (g,'fractii.out');
reset(f);
rewrite (g);
readln (f,n);
jk:=0;
for i:=2 to n do
begin
ok:=true;
for j:=2 to trunc(sqrt(i)) do
begin
if i mod j=0
then
ok:=false;
end;
if ok
then
begin
if jk < (n div i)-1
then
jk:=(n div i)-1;
a[(n div i)-1]:=a[(n div i)-1]+1;
end;
end;
coef:=0;
for i:=1 to jk do
begin
coef:=coef+i;
if a[i]<>0
then
suma:=suma+(a[i]*coef);
end;
i:=n*n;
i:=i-(2*suma);
i:=i-n+1;
writeln (g,i);
close (f);
close (g);
End.