OFFSET
1,3
LINKS
Felix Fröhlich, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = n*(n-1)/2 - Sum_{k=1..n-1} (1 - ceiling(n/k^2) + floor(n/k^2)) * k.
For n > 1, a(n) = n*(n-1)/2 - sigma(sqrt(n/A007913(n)) = A000217(n-1)-A000203(sqrt(n/A007913(n)). - Chai Wah Wu, Jan 31 2021
EXAMPLE
a(7) = 20; 1^2|7, but the squares of 2,3,4,5 and 6 do not. So a(7) = 2 + 3 + 4 + 5 + 6 = 20.
a(8) = 25; 1^2|8 and 2^2|8, but the squares of 3,4,5,6 and 7 do not. So a(8) = 3 + 4 + 5 + 6 + 7 = 25.
MATHEMATICA
Table[Sum[k*(Ceiling[n/k^2] - Floor[n/k^2]), {k, n - 1}], {n, 60}]
PROG
(PARI) a(n) = sum(k=1, n-1, if (n % k^2, k)); \\ Michel Marcus, Jan 31 2021
(PARI) a(n) = my(res = binomial(n, 2), f = factor(n)); f[, 2]>>=1; res-sigma(factorback(f))+(n==1) \\ David A. Corneth, Jan 31 2021
(Python)
from sympy import divisor_sigma, integer_nthroot
from sympy.ntheory.factor_ import core
def A338234(n):
return 0 if n <= 1 else n*(n-1)//2 - divisor_sigma(integer_nthroot(n//core(n, 2), 2)[0]) # Chai Wah Wu, Jan 31 2021
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Wesley Ivan Hurt, Jan 30 2021
STATUS
approved