login
a(n) = Sum_{k=1..n} antisigma(k), where antisigma(i) = sum of the nondivisors of i that are between 1 and i.
5

%I #25 Oct 22 2023 16:35:49

%S 0,0,2,5,14,23,43,64,96,133,187,237,314,395,491,596,731,863,1033,1201,

%T 1400,1617,1869,2109,2403,2712,3050,3400,3805,4198,4662,5127,5640,

%U 6181,6763,7338,8003,8684,9408,10138,10957,11764,12666,13572,14529,15538

%N a(n) = Sum_{k=1..n} antisigma(k), where antisigma(i) = sum of the nondivisors of i that are between 1 and i.

%C Sum of all proper nondivisors of all positive integers <= n. - _Omar E. Pol_, Feb 11 2014

%H Vincenzo Librandi, <a href="/A076664/b076664.txt">Table of n, a(n) for n = 1..1000</a>

%F a(n) = A000292(n) - A024916(n), n >= 1. _Omar E. Pol_, Feb 11 2014

%F a(n) = Sum_{k=1..n} Sum_{i=1..k-1} (n-k-i+1) mod (n-i+1). - _Wesley Ivan Hurt_, Sep 13 2017

%F G.f.: x/(1 - x)^4 - (1/(1 - x))*Sum_{k>=1} k*x^k/(1 - x^k). - _Ilya Gutkovskiy_, Sep 18 2017

%e a(5) = antisigma(1) + ... + antisigma(5) = 0 + 0 + 2 + 3 + 9 = 14.

%t l = {}; s = 0; Do[s = s + (n (n + 1) / 2) - DivisorSigma[1, n]; l = Append[l, s], {n, 1, 100}]; l

%t Accumulate[Table[Total[Complement[Range[n],Divisors[n]]],{n,50}]] (* _Harvey P. Dale_, May 19 2014 *)

%o (PARI) a(n) = sum(k=1, n, k*(k+1)/2-sigma(k)); \\ _Michel Marcus_, Sep 18 2017

%o (Python)

%o from math import isqrt

%o def A076664(n): return n*(n+1)*(n+2)//3+(s:=isqrt(n))**2*(s+1)-sum((q:=n//k)*((k<<1)+q+1) for k in range(1,s+1))>>1 # _Chai Wah Wu_, Oct 22 2023

%Y Cf. A024816, A000292, A024916.

%K nonn,easy

%O 1,3

%A _Joseph L. Pe_, Oct 24 2002