[go: up one dir, main page]

login
A363421
a(n) = Sum_{k=0..n}(n^[not(k | n)] - n^[k | n]), where '[ ]' denotes the Iverson bracket.
5
1, 0, -1, 0, -3, 8, -5, 24, 7, 32, 27, 80, 11, 120, 91, 112, 105, 224, 119, 288, 171, 280, 315, 440, 207, 480, 475, 520, 459, 728, 435, 840, 651, 832, 891, 952, 665, 1224, 1147, 1216, 975, 1520, 1107, 1680, 1419, 1496, 1755, 2024, 1363, 2112, 1911, 2200, 2091
OFFSET
0,5
LINKS
FORMULA
a(n) = n^2 - 2*(n - 1)*tau(n) - 1 for n >= 1, where tau = A000005.
MATHEMATICA
A363421[n_]:=If[n==0, 1, n^2-2(n-1)DivisorSigma[0, n]-1]; Array[A363421, 100, 0] (* Paolo Xausa, Aug 06 2023 *)
PROG
(SageMath)
print([sum(n^(not k.divides(n)) - n^k.divides(n) for k in srange(n+1)) for n in srange(53)])
(Python)
from sympy import divisor_count
def A363421(n): return n**2-2*(n-1)*divisor_count(n)-1 if n else 1 # Chai Wah Wu, Jun 28 2023
CROSSREFS
KEYWORD
sign
AUTHOR
Peter Luschny, Jun 27 2023
STATUS
approved