OFFSET
1,3
COMMENTS
Graph resembles that of Euler's totient function (A000010).
LINKS
Michel Marcus, Table of n, a(n) for n = 1..10000
EXAMPLE
a(12) = floor(average of {12-1, 6-2, 4-3}) = 5.
a(16) = floor(average of {16-1, 8-2, 4-4}) = 7.
MATHEMATICA
A351752[n_] := Floor[Mean[TakeWhile[Reverse[#] - #, NonNegative]]] & [Divisors[n]];
Array[A351752, 100] (* Paolo Xausa, Jan 16 2026 *)
PROG
(Python)
from sympy import divisors
def a(n):
arr = divisors(n)
length = (len(arr)+1)//2
total = 0
for i in range(length):
total += arr[-(i+1)] - arr[i]
return total // length
for i in range(1, 80):
print("{}, ".format(a(i)), end="")
(PARI) a(n) = my(v=divisors(n)); vecsum(abs(v-Vecrev(v))) \ (#v + #v%2); \\ Kevin Ryde, Mar 10 2022
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Christoph B. Kassir, Mar 09 2022
STATUS
approved
