login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A162511 Multiplicative function with a(p^e) = (-1)^(e-1). 12

%I #43 Oct 26 2023 08:31:19

%S 1,1,1,-1,1,1,1,1,-1,1,1,-1,1,1,1,-1,1,-1,1,-1,1,1,1,1,-1,1,1,-1,1,1,

%T 1,1,1,1,1,1,1,1,1,1,1,1,1,-1,-1,1,1,-1,-1,-1,1,-1,1,1,1,1,1,1,1,-1,1,

%U 1,-1,-1,1,1,1,-1,1,1,1,-1,1,1,-1,-1,1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,1,-1

%N Multiplicative function with a(p^e) = (-1)^(e-1).

%H G. C. Greubel, <a href="/A162511/b162511.txt">Table of n, a(n) for n = 1..5000</a>

%H Gérard P. Michon, <a href="http://www.numericana.com/answer/numbers.htm#multiplicative">Multiplicative functions</a>.

%F Multiplicative function with a(p^e)=(-1)^(e-1) for any prime p and any positive exponent e.

%F a(n) = 1 when n is a squarefree number (A005117).

%F From _Reinhard Zumkeller_, Jul 08 2009 (Start)

%F a(n) = (-1)^(A001222(n)-A001221(n)).

%F a(A162644(n)) = +1; a(A162645(n)) = -1. (End)

%F a(n) = A076479(n) * A008836(n). - _R. J. Mathar_, Mar 30 2011

%F Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = A307868. - _Amiram Eldar_, Sep 18 2022

%F Dirichlet g.f.: Product_{p prime} ((p^s + 2)/(p^s + 1)). - _Amiram Eldar_, Oct 26 2023

%p A162511 := proc(n)

%p local a,f;

%p a := 1;

%p for f in ifactors(n)[2] do

%p a := a*(-1)^(op(2,f)-1) ;

%p end do:

%p return a;

%p end proc: # _R. J. Mathar_, May 20 2017

%t a[n_] := (-1)^(PrimeOmega[n] - PrimeNu[n]); Array[a, 100] (* _Jean-François Alcover_, Apr 24 2017, after _Reinhard Zumkeller_ *)

%o (PARI) a(n)=my(f=factor(n)[,2]); prod(i=1,#f,-(-1)^f[i]) \\ _Charles R Greathouse IV_, Mar 09 2015

%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, [(-1)**(f[i] - 1) for i in f]) # _Indranil Ghosh_, May 20 2017

%o (Python)

%o from functools import reduce

%o from sympy import factorint

%o def A162511(n): return -1 if reduce(lambda a,b:~(a^b), factorint(n).values(),0)&1 else 1 # _Chai Wah Wu_, Jan 01 2023

%Y Cf. A005117, A076479, A162510, A162512, A002035, A072587, A036537, A162643, A162644, A162645, A046660, A008836, A307868.

%K easy,mult,sign

%O 1,1

%A _Gerard P. Michon_, Jul 05 2009

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 19 01:57 EDT 2024. Contains 370952 sequences. (Running on oeis4.)