login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A338231
Sum of the numbers less than or equal to n whose square does not divide n.
7
0, 2, 5, 7, 14, 20, 27, 33, 41, 54, 65, 75, 90, 104, 119, 129, 152, 167, 189, 207, 230, 252, 275, 297, 319, 350, 374, 403, 434, 464, 495, 521, 560, 594, 629, 654, 702, 740, 779, 817, 860, 902, 945, 987, 1031, 1080, 1127, 1169, 1217, 1269, 1325, 1375, 1430, 1481, 1539
OFFSET
1,2
LINKS
FORMULA
a(n) = n*(n+1)/2 - Sum_{k=1..n} (1 - ceiling(n/k^2) + floor(n/k^2)) * k.
a(n) = n*(n+1)/2-sigma(sqrt(n/A007913(n)) = A000217(n)-A000203(sqrt(n/A007913(n)). - Chai Wah Wu, Jan 31 2021
EXAMPLE
a(3) = 5; 1^1|3, but 2^2 and 3^2 do not. Then 2 + 3 = 5.
a(4) = 7; 1^2|4 and 2^2|4, but 3^2 and 4^2 do not. Then 3 + 4 = 7.
MATHEMATICA
Table[Sum[k (Ceiling[n/k^2] - Floor[n/k^2]), {k, n}], {n, 80}]
PROG
(PARI) a(n) = sum(k=1, n, if (n % k^2, k)); \\ Michel Marcus, Jan 31 2021
(Python)
from sympy import divisor_sigma, integer_nthroot
from sympy.ntheory.factor_ import core
def A338231(n):
return n*(n+1)//2-divisor_sigma(integer_nthroot(n//core(n, 2), 2)[0]) # Chai Wah Wu, Jan 31 2021
KEYWORD
nonn,easy
AUTHOR
Wesley Ivan Hurt, Jan 30 2021
STATUS
approved