login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

a(n) is the alternating sum of the unitary divisors of n, when these divisors are starting with n and decreasing.
3

%I #9 Feb 27 2024 01:31:16

%S 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,

%T 26,24,28,22,30,31,24,18,32,30,36,20,28,36,40,32,42,36,40,24,46,34,48,

%U 26,36,42,52,28,48,54,40,30,58,46,60,32,60,63,56,48,66,54

%N a(n) is the alternating sum of the unitary divisors of n, when these divisors are starting with n and decreasing.

%C a(n) is odd if and only if n is a power of 2.

%H Amiram Eldar, <a href="/A370681/b370681.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = A071324(n) if n is squarefree (A005117) or if n is in A370683.

%e The unitary divisors of 6 are {1, 2, 3, 6}, hence a(6) = 6 - 3 + 2 - 1 = 4.

%e The unitary divisors of 12 are {1, 3, 4, 12}, hence a(12) = 12 - 4 + 3 - 1 = 10.

%t a[n_] := Module[{d = Reverse[Select[Divisors[n], CoprimeQ[#, n/#] &]]}, Total[(-1)^(Range[Length[d]] + 1)*d]]; Array[a, 100]

%o (PARI) a(n) = {my(d = Vecrev(select(x->(gcd(x, n/x) == 1), divisors(n)))); sum(i=1, #d, (-1)^(i+1)*d[i]);}

%Y Cf. A005117, A034448, A071323, A071324, A077610, A370683.

%K nonn,easy

%O 1,3

%A _Amiram Eldar_, Feb 26 2024