OFFSET
1,3
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000
FORMULA
EXAMPLE
a(3) = 4 because 3 has 2 divisors {1,3} therefore 1 non-divisor {2} and 2^2 = 4;
a(4) = 9 because 4 has 3 divisors {1,2,4} therefore 1 non-divisor {3} and 3^2 = 9;
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.
MATHEMATICA
Table[n (n + 1) ((2 n + 1)/6) - DivisorSigma[2, n], {n, 1, 50}]
Table[Total[Complement[Range[n], Divisors[n]]^2], {n, 50}] (* Harvey P. Dale, May 10 2018 *)
PROG
(PARI) a(n) = n*(n + 1)*(2*n + 1)/6 - sigma(n, 2); \\ Michel Marcus, Sep 29 2016
CROSSREFS
KEYWORD
nonn,easy,changed
AUTHOR
Ilya Gutkovskiy, Sep 29 2016
STATUS
approved