%I #30 Jun 22 2024 16:17:47
%S 0,0,2,11,31,71,131,229,357,537,767,1064,1412,1867,2385,3000,3720,
%T 4570,5506,6608,7808,9194,10734,12436,14260,16360,18622,21079,23739,
%U 26668,29758,33199,36815,40742,44924,49369,54085,59265,64661,70355
%N a(n) = Sum {k + j*m <= n} (k + j*m), with 0 < k,j,m <= n.
%H M. F. Hasler, <a href="/A106847/b106847.txt">Table of n, a(n) for n = 0..9999</a>
%F From _Ridouane Oudra_, Jun 02 2024: (Start)
%F a(n) = (1/2)*Sum_{k=1..n} (n^2 + n - k^2 - k)*tau(k);
%F a(n) = (1/2)*(n^2 + n)*A006218(n) - Sum_{k=1..n} A143272(k);
%F a(n) = (1/2)*((n + 1)*A143274(n) - A143127(n) - A319085(n)). (End)
%F a(n) ~ n^3 * (log(n) + 2*gamma - 4/3)/3, where gamma is the Euler-Mascheroni constant A001620. - _Vaclav Kotesovec_, Jun 15 2024
%e We have 1+1*1=2<=3, 1+2*1=3, 1+1*2=3, 2+1*1=3, thus a(3)=2+3+3+3=11.
%p A106847 := proc(n)
%p local a,k,l,m ;
%p a := 0 ;
%p for k from 1 to n do
%p for l from 1 to n-k do
%p m := floor((n-k)/l) ;
%p if m >=1 then
%p m := min(m,n) ;
%p a := a+m*k+l*m*(m+1)/2 ;
%p end if;
%p end do:
%p end do:
%p a ;
%p end proc: # _R. J. Mathar_, Oct 17 2012
%t A106847[n_] := Module[{a, k, l, m}, a = 0; For[k = 1, k <= n, k++, For[l = 1, l <= n - k, l++, If[l == 0, m = n, m = Floor[(n - k)/l]]; If[m >= 1, m = Min[m, n]; a = a + m*k + l*m*(m + 1)/2]]]; a];
%t Table[A106847[n], {n, 0, 40}] (* _Jean-François Alcover_, Apr 04 2024, after _R. J. Mathar_ *)
%o (PARI) A106847(n)=sum(m=1,n-1,sum(k=1,(n-1)\m,(n-m*k)*(n+m*k+1)))/2 \\ _M. F. Hasler_, Oct 17 2012
%Y Cf. A106633, A106634, A106846, A078567 (number of terms).
%Y Cf. A006218, A143272, A143274, A143127, A319085.
%K nonn
%O 0,3
%A _Ralf Stephan_, May 06 2005
|