login
A322862
a(n) = A000120(A285330(n)).
3
0, 1, 1, 1, 1, 2, 1, 1, 2, 2, 1, 2, 1, 2, 2, 1, 1, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 3, 1, 3, 1, 1, 2, 2, 2, 2, 1, 2, 2, 2, 1, 3, 1, 3, 4, 2, 1, 2, 3, 2, 2, 3, 1, 2, 2, 3, 2, 2, 1, 4, 1, 2, 3, 1, 2, 3, 1, 2, 2, 3, 1, 4, 1, 2, 4, 3, 2, 3, 1, 3, 4, 2, 1, 3, 2, 2, 2, 3, 1, 4, 2, 4, 2, 2, 2, 2, 1, 3, 2, 2, 1, 3, 1, 3, 3
OFFSET
1,6
FORMULA
a(n) = A000120(A285330(n)).
If n is squarefree, a(n) = A322869(n) = A000120(A048675(n)) = A001221(n), otherwise a(n) = A000120(A285328(n)).
MATHEMATICA
Table[DigitCount[#, 2, 1] &@ Which[n == 1, 0, MoebiusMu@ n != 0, Total@ Map[#2*2^(PrimePi@ #1 - 1) & @@ # &, FactorInteger[n]], True, With[{r = DivisorSum[n, EulerPhi[#] Abs@ MoebiusMu[#] &]}, SelectFirst[Range[n - 2, 2, -1], DivisorSum[#, EulerPhi[#] Abs@ MoebiusMu[#] &] == r &]]], {n, 105}] (* Michael De Vlieger, Dec 31 2018 *)
PROG
(PARI)
A007947(n) = factorback(factorint(n)[, 1]); \\ From A007947
A048675(n) = my(f = factor(n)); sum(k=1, #f~, f[k, 2]*2^primepi(f[k, 1]))/2; \\ From A048675
A285328(n) = { my(r); if((n > 1 && !bitand(n, (n-1))), (n/2), r=A007947(n); if(r==n, 1, n = n-r; while(A007947(n) <> r, n = n-r); n)); };
A285330(n) = if(moebius(n)<>0, A048675(n), A285328(n));
A322862(n) = hammingweight(A285330(n));
\\ Or just as:
A322862(n) = if(issquarefree(n), omega(n), hammingweight(A285328(n)));
KEYWORD
nonn
AUTHOR
Antti Karttunen, Dec 31 2018
STATUS
approved