OFFSET
1,3
COMMENTS
Alternating row sums of A056538. - Omar E. Pol, Feb 17 2024
Does a constant analogous to the median abundancy index (see A353617) exist for this function? Particularly, does a constant exist such that the numbers having the value a(n)/n greater than this constant have natural density exactly 1/2? Using the first 10^7 values, one observes that if it exists, this constant appears to converge around 0.726. - Shreyansh Jaiswal, Apr 16 2025
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
Krassimir Atanassov, A remark on an arithmetic function. Part 2, Notes on Number Theory and Discrete Mathematics 15(3) (2009), 21-22.
Shreyansh Jaiswal, On two Conjectures by Atanassov on the Alternating sum-of-divisors function, Jun 11 2025
FORMULA
a(n) = Sum_{i=1..n} (A135539(n,i) mod 2). - Ridouane Oudra, Nov 23 2022
From Shreyansh Jaiswal, Apr 16 2025: (Start)
a(p) = p-1 for prime p.
For odd n, 2n/3 <= a(n) <= n.
For even n, n/2 <= a(n) <= 5n/6.
a(n) >= A000010(n) for n>=1. (End)
EXAMPLE
Divisors of 20: {1,2,4,5,10,20} therefore a(20) = 20 - 10 + 5 - 4 + 2 - 1 = 12.
MAPLE
with(numtheory): a:=proc(n) local k, t:=0, A:=divisors(n); for k to tau(n) do t:= t+A[k]*(-1)^(tau(n)-k) end do; return t; end proc; seq(a(n), n=1..60); # Ridouane Oudra, Nov 23 2022
MATHEMATICA
a[n_] := Plus @@ (-(d = Divisors[n])*(-1)^(Range[Length[d], 1, -1])); Array[a, 100] (* Amiram Eldar, Mar 11 2020 *)
Table[Total[Times@@@Partition[Riffle[Reverse[Divisors[n]], {1, -1}, {2, -1, 2}], 2]], {n, 80}] (* Harvey P. Dale, Nov 06 2022 *)
PROG
(PARI) a(n) = my(d=Vecrev(divisors(n))); sum(k=1, #d, (-1)^(k+1)*d[k]); \\ Michel Marcus, Aug 11 2018
(APL) ⍝ Dyalog dialect
divisors ← {⍺←⍵{(0=⍵|⍺)/⍵}⍳⌊⍵*÷2 ⋄ 1=⍵:⍺ ⋄ ⍺, (⍵∘÷)¨(⍵=(⌊⍵*÷2)*2)↓⌽⍺}
A071324 ← {-/⌽(divisors ⍵)} ⍝ Antti Karttunen, Feb 16 2024
(Python)
from sympy import divisors; from functools import lru_cache
cached_divisors = lru_cache()(divisors)
def a(n): return sum(d if i%2==0 else -d for i, d in enumerate(reversed(cached_divisors(n))))
A071324 = [a(i) for i in range(1, 74)] # Jwalin Bhatt, Apr 02 2025
CROSSREFS
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, May 18 2002, Jul 03 2008
STATUS
approved
