%I #23 Nov 19 2024 04:31:20
%S 0,0,4,9,29,41,90,119,194,255,384,440,649,765,980,1155,1495,1654,2108,
%T 2324,2811,3185,3794,4050,4874,5351,6110,6664,7713,8155,9454,10075,
%U 11309,12235,13610,14295,16205,17209,18840,19930,22139,23085,25584,26808,29029,30861,33510,34614,37974,39670
%N Sum of squares of numbers less than n that do not divide n.
%H Amiram Eldar, <a href="/A276984/b276984.txt">Table of n, a(n) for n = 1..10000</a>
%F Dirichlet g.f.: (2 zeta(s-3) + 3*zeta(s-2) + zeta(s-1) - 6*zeta(s-2)*zeta(s))/6.
%F a(n) = n*(n + 1)*(2*n + 1)/6 - sigma_2(n).
%F a(n) = A000330(n) - A001157(n).
%e a(3) = 4 because 3 has 2 divisors {1,3} therefore 1 non-divisor {2} and 2^2 = 4;
%e a(4) = 9 because 4 has 3 divisors {1,2,4} therefore 1 non-divisor {3} and 3^2 = 9;
%e a(5) = 29 because 5 has 2 divisors {1,5} therefore 3 non-divisors {2,3,4} and 2^2 + 3^2 + 4^2 = 29, etc.
%t Table[n (n + 1) ((2 n + 1)/6) - DivisorSigma[2, n], {n, 1, 50}]
%t Table[Total[Complement[Range[n],Divisors[n]]^2],{n,50}] (* _Harvey P. Dale_, May 10 2018 *)
%o (PARI) a(n) = n*(n + 1)*(2*n + 1)/6 - sigma(n, 2); \\ _Michel Marcus_, Sep 29 2016
%Y Cf. A000330, A001157, A024816, A049820.
%K nonn,easy
%O 1,3
%A _Ilya Gutkovskiy_, Sep 29 2016