login
A351752
Floor of the average of the numbers |x-y| over all pairs (x,y) with x*y = n, x <= y.
0
0, 1, 2, 1, 4, 3, 6, 4, 4, 6, 10, 5, 12, 9, 8, 7, 16, 9, 18, 9, 12, 15, 22, 10, 12, 18, 16, 14, 28, 12, 30, 16, 20, 24, 18, 13, 36, 27, 24, 16, 40, 18, 42, 23, 20, 33, 46, 18, 24, 25, 32, 28, 52, 24, 30, 23, 36, 42, 58, 21, 60, 45, 27, 26, 36, 30, 66, 37
OFFSET
1,3
COMMENTS
Graph resembles that of Euler's totient function (A000010).
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.
PROG
(Python)
from math import floor, ceil
from sympy import divisors
def a(n):
arr = divisors(n)
length = ceil(len(arr)/2)
total = 0
for i in range(length):
total += arr[-(i+1)] - arr[i]
avg = total / length
return floor(avg)
def main():
for i in range(1, 250):
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
Sequence in context: A338657 A347082 A186421 * A361189 A004560 A345668
KEYWORD
nonn
AUTHOR
Christoph B. Kassir, Mar 09 2022
STATUS
approved