login
a(n) = floor(s(n) - n*(log(n) + 2*Gamma - 1)), where s(n) = sum_{k=1..n} tau(k), where tau(k) is the number of divisors of k.
1

%I #28 Sep 07 2018 04:43:16

%S 0,1,1,1,1,2,1,2,1,2,0,3,1,1,2,3,1,3,1,2,2,2,0,4,2,2,1,3,0,4,1,3,2,1,

%T 1,5,2,1,1,4,1,4,1,2,3,2,-1,4,2,3,2,3,0,3,2,4,3,2,-1,6,2,1,2,3,2,5,1,

%U 2,1,3,0,6,3,2,2,3,1,4,0,5,4,2,-1,5,4,2

%N a(n) = floor(s(n) - n*(log(n) + 2*Gamma - 1)), where s(n) = sum_{k=1..n} tau(k), where tau(k) is the number of divisors of k.

%C Dirichlet proved this sequence is O(n^1/2).

%H G. C. Greubel, <a href="/A230583/b230583.txt">Table of n, a(n) for n = 1..10000</a>

%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Divisor_summatory_function">Divisor summatory function</a>

%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Euler-Mascheroni_constant">Euler-Mascheroni constant</a>

%F a(n) = Sum(A000005(k), k=1..n) - n*(log(n) + 0.1544313298), where the decimal is (approximately) 2*Gamma-1.

%t s = 0; Table[s = s + DivisorSigma[0, n]; Floor[s - n*(Log[n] + 2*EulerGamma - 1)], {n, 100}] (* _T. D. Noe_, Nov 04 2013 *)

%o (JavaScript)

%o function sigma(n,k) {

%o var j,s,sn;

%o s=0;

%o sn=Math.sqrt(n);

%o for (j=1;j<sn;j++) if (n%j==0) s+=Math.pow(j,k)+Math.pow(n/j,k);

%o if (n%sn==0) s+=Math.pow(sn,k);

%o return s;

%o }

%o c=0;

%o for (i=1;i<100;i++) {

%o c+=sigma(i,0);

%o document.write(Math.floor(c-i*(Math.log(i)+0.1544313298))+", ");

%o }

%Y Cf. A000005, A001620, A006218, A230501.

%K sign

%O 1,6

%A _Jon Perry_, Oct 24 2013