login
This site is supported by donations 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) 7

%I

%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)

%C a(A162644(n)) = +1; a(A162645(n)) = -1. [_Reinhard Zumkeller_, Jul 08 2009]

%H G. C. Greubel, <a href="/A162511/b162511.txt">Table of n, a(n) for n = 1..5000</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)=(-1)^(e-1) for any prime p and any positive exponent e.

%F a(n) = (-1)^(A001222(n)-A001221(n)). - _Reinhard Zumkeller_, Jul 08 2009

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

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

%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

%Y Cf. A076479, A162510, A162512, A002035, A072587, A036537, A162643, A046660.

%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 | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified February 16 14:47 EST 2019. Contains 320163 sequences. (Running on oeis4.)