%I #26 Oct 26 2023 08:31:15
%S 1,-1,-1,2,-1,1,-1,-4,2,1,-1,-2,-1,1,1,8,-1,-2,-1,-2,1,1,-1,4,2,1,-4,
%T -2,-1,-1,-1,-16,1,1,1,4,-1,1,1,4,-1,-1,-1,-2,-2,1,-1,-8,2,-2,1,-2,-1,
%U 4,1,4,1,1,-1,2,-1,1,-2,32,1,-1,-1,-2,1,-1,-1,-8,-1,1,-2,-2,1,-1,-1,-8,8,1
%N Dirichlet inverse of A162511.
%C The absolute value of this sequence is A162510.
%C The Moebius function (A008683) can be defined in terms of this sequence: A008683(n) is equal to a(n) if a(n) is odd and zero otherwise.
%H Antti Karttunen, <a href="/A162512/b162512.txt">Table of n, a(n) for n = 1..10000</a>
%H G. P. Michon, <a href="http://www.numericana.com/answer/numbers.htm#multiplicative">Multiplicative functions</a>.
%F Multiplicative function with a(p^e)=-(-2)^(e-1) for any prime p and any positive exponent e.
%F a(n) = n/2 when n is a power of 4 (A000302).
%F a(n) = A008683(n) when n is a squarefree number (A005117).
%F Dirichlet g.f.: Product_{p prime} ((p^s + 1)/(p^s + 2)). - _Amiram Eldar_, Oct 26 2023
%p A162512 := proc(n)
%p local a,f;
%p a := 1;
%p for f in ifactors(n)[2] do
%p a := -a*(-2)^(op(2,f)-1) ;
%p end do:
%p return a;
%p end proc:
%p seq(A162512(n),n=1..100) ; # _R. J. Mathar_, May 20 2017
%t b[n_] := (-1)^(PrimeOmega[n] - PrimeNu[n]);
%t a[n_] := a[n] = If[n == 1, 1, -Sum[b[n/d] a[d], {d, Most@ Divisors[n]}]];
%t Array[a, 100] (* _Jean-François Alcover_, Feb 17 2020 *)
%o (PARI) a(n) = my(f=factor(n)); for(i=1, #f~, f[i,1]=-(-2)^(f[i,2]-1); f[i,2]=1); factorback(f); \\ _Michel Marcus_, May 20 2017
%o (Python)
%o from sympy import factorint
%o from operator import mul
%o def a(n):
%o f=factorint(n)
%o return 1 if n==1 else reduce(mul, [-(-2)**(f[i] - 1) for i in f]) # _Indranil Ghosh_, May 20 2017
%o (Scheme) (define (A162512 n) (if (= 1 n) n (* (- (expt -2 (- (A067029 n) 1))) (A162512 (A028234 n))))) ;; _Antti Karttunen_, May 20 2017, after the given multiplicative formula.
%Y Cf. A005117, A008683, A067029, A076479, A162150, A162511.
%K easy,mult,sign
%O 1,4
%A _Gerard P. Michon_, Jul 05 2009, Jul 06 2009
|