OFFSET
1,3
COMMENTS
a(n) is odd if and only if n is a power of 2.
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000
EXAMPLE
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.
MATHEMATICA
a[n_] := Module[{d = Reverse[Select[Divisors[n], CoprimeQ[#, n/#] &]]}, Total[(-1)^(Range[Length[d]] + 1)*d]]; Array[a, 100]
PROG
(PARI) a(n) = {my(d = Vecrev(select(x->(gcd(x, n/x) == 1), divisors(n)))); sum(i=1, #d, (-1)^(i+1)*d[i]); }
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Amiram Eldar, Feb 26 2024
STATUS
approved