login
Sign(n) (with offset -1): a(n) = 1 if n>0, = -1 if n<0, = 0 if n = 0.
2

%I #19 May 12 2019 15:37:45

%S -1,0,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,

%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,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,1,1,1,1,1,1,1

%N Sign(n) (with offset -1): a(n) = 1 if n>0, = -1 if n<0, = 0 if n = 0.

%C For nonnegative n, partial sums of A063524 (characteristic function of 1). - _Jeremy Gardiner_, Sep 08 2002

%C For nonnegative n, characteristic function of positive integers. - _Franklin T. Adams-Watters_, Aug 01 2011

%C a(A000027(n)) = 1; a(A000004(n)) = 0. - _Reinhard Zumkeller_, Oct 11 2008

%C Central terms of the triangle in A152487. - _Reinhard Zumkeller_, Dec 06 2008

%C n-th prime mod 2 (with offset 1,1). - _Philippe Deléham_, Apr 04 2009

%D T. M. Macrobert, Functions of a Complex Variable, 4th ed., Macmillan and Co, London, 1958, p. 90

%H <a href="/index/Ch#char_fns">Index entries for characteristic functions</a>

%H <a href="/index/Rec#order_01">Index entries for linear recurrences with constant coefficients</a>, signature (1).

%F G.f.: Sum_{k>=0} 2^k*x^(2^k)/(1+x^(2^k)). - _Michael Somos_, Sep 11 2005

%F For n>=0, a(n) = A000007(0^n). - _Jaume Oliver Lafont_, Mar 19 2009

%F a(0) = 0, a(n) = n/|n| or |n|/n for n != 0. - _Jon Perry_, Sep 20 2012

%F G.f.: -(x^2+x-1) / (x*(x-1)). - _Colin Barker_, Mar 13 2014

%p with(numtheory); A057427:=n->signum(n); seq(A057427(k), k=-1..50); # _Wesley Ivan Hurt_, Oct 22 2013

%t Sign[Range[-1,120]] (* or *) PadRight[{-1,0},120,{1}] (* _Harvey P. Dale_, May 12 2019 *)

%o (PARI) a(n)=sign(n)

%o (Haskell)

%o a261012 = signum

%o a261012_list = -1 : 0 : [1, 1 ..] -- _Reinhard Zumkeller_, Nov 28 2012

%Y A057427 is the official entry for sign(n) or signum(n). - _N. J. A. Sloane_, Aug 16 2015

%K easy,sign,mult

%O -1,1

%A _Henry Bottomley_, Sep 05 2000

%E a(-1) = -1 added by _Jon Perry_, Sep 20 2012

%E Incorrect g.f. and e.g.f. removed by _Joerg Arndt_, Oct 22 2013

%E The initial a(-1)=-1 should never have been added.