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

COMMENTS

a(A162644(n)) = +1; a(A162645(n)) = -1. [Reinhard Zumkeller, Jul 08 2009]

LINKS

G. C. Greubel, Table of n, a(n) for n = 1..5000

G. 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)^(A001222(n)-A001221(n)). - Reinhard Zumkeller, Jul 08 2009

a(n) = A076479(n) * A008836(n). - R. J. Mathar, Mar 30 2011

EXAMPLE

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

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

CROSSREFS

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

Sequence in context: A155040 A033999 A000012 * A157895 A063747 A077008

Adjacent sequences:  A162508 A162509 A162510 * A162512 A162513 A162514

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

License Agreements, Terms of Use, Privacy Policy .

Last modified July 25 12:29 EDT 2017. Contains 289795 sequences.