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
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, 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, -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 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
LINKS
Gérard P. Michon, Multiplicative functions.
FORMULA
Multiplicative function with a(p^e)=(-1)^(e-1) for any prime p and any positive exponent e.
a(n) = 1 when n is a squarefree number (A005117).
From Reinhard Zumkeller, Jul 08 2009 (Start)
a(n) = (-1)^(A001222(n)-A001221(n)).
a(A162644(n)) = +1; a(A162645(n)) = -1. (End)
a(n) = A076479(n) * A008836(n). - R. J. Mathar, Mar 30 2011
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = A307868. - Amiram Eldar, Sep 18 2022
Dirichlet g.f.: Product_{p prime} ((p^s + 2)/(p^s + 1)). - Amiram Eldar, Oct 26 2023
MAPLE
A162511 := proc(n)
local a, f;
a := 1;
for f in ifactors(n)[2] do
a := a*(-1)^(op(2, f)-1) ;
end do:
return a;
end proc: # R. J. Mathar, May 20 2017
MATHEMATICA
a[n_] := (-1)^(PrimeOmega[n] - PrimeNu[n]); Array[a, 100] (* Jean-François Alcover, Apr 24 2017, after Reinhard Zumkeller *)
PROG
(PARI) a(n)=my(f=factor(n)[, 2]); prod(i=1, #f, -(-1)^f[i]) \\ Charles R Greathouse IV, Mar 09 2015
(Python)
from sympy import factorint
from operator import mul
def a(n):
f=factorint(n)
return 1 if n==1 else reduce(mul, [(-1)**(f[i] - 1) for i in f]) # Indranil Ghosh, May 20 2017
(Python)
from functools import reduce
from sympy import factorint
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
CROSSREFS
Sequence in context: A216430 A232544 A309873 * A157895 A077008 A158387
KEYWORD
easy,mult,sign
AUTHOR
Gerard P. Michon, Jul 05 2009
STATUS
approved

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 03:33 EDT 2024. Contains 370952 sequences. (Running on oeis4.)