A370681 a(n) is the alternating sum of the unitary divisors of n, when these divisors are starting with n and decreasing.
1, 1, 2, 3, 4, 4, 6, 7, 8, 6, 10, 10, 12, 8, 12, 15, 16, 10, 18, 18, 16, 12, 22, 18, 24, 14, 26, 24, 28, 22, 30, 31, 24, 18, 32, 30, 36, 20, 28, 36, 40, 32, 42, 36, 40, 24, 46, 34, 48, 26, 36, 42, 52, 28, 48, 54, 40, 30, 58, 46, 60, 32, 60, 63, 56, 48, 66, 54
Offset: 1
Examples
The unitary divisors of 6 are {1, 2, 3, 6}, hence a(6) = 6 - 3 + 2 - 1 = 4. The unitary divisors of 12 are {1, 3, 4, 12}, hence a(12) = 12 - 4 + 3 - 1 = 10.
Links
- Amiram Eldar, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
a[n_] := Module[{d = Reverse[Select[Divisors[n], CoprimeQ[#, n/#] &]]}, Total[(-1)^(Range[Length[d]] + 1)*d]]; Array[a, 100]
-
PARI
a(n) = {my(d = Vecrev(select(x->(gcd(x, n/x) == 1), divisors(n)))); sum(i=1, #d, (-1)^(i+1)*d[i]);}
Comments