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!)
A001057 Canonical enumeration of integers: interleaved positive and negative integers with zero prepended. 106

%I #131 Sep 22 2023 03:20:26

%S 0,1,-1,2,-2,3,-3,4,-4,5,-5,6,-6,7,-7,8,-8,9,-9,10,-10,11,-11,12,-12,

%T 13,-13,14,-14,15,-15,16,-16,17,-17,18,-18,19,-19,20,-20,21,-21,22,

%U -22,23,-23,24,-24,25,-25,26,-26,27,-27,28,-28,29,-29,30,-30,31,-31

%N Canonical enumeration of integers: interleaved positive and negative integers with zero prepended.

%C Unsigned sequence (A008619) gives number of partitions of n in which the greatest part is 2. - _Robert G. Wilson v_, Jan 11 2002

%C Go forwards and backwards with increasing step sizes. - _Daniele Parisse_ and Franco Virga, Jun 06 2005

%C The partial sums of the divergent series 1 - 2 + 3 - 4 + ... give this sequence. Euler summed it to 1/4 which was one of the first examples of summing divergent series. - _Michael Somos_, May 22 2007

%C From _Peter Luschny_, Jul 12 2009: (Start)

%C The general formula for alternating sums of powers is in terms of the Swiss-Knife polynomials P(n,x) A153641 2^(-n-1)(P(n,1)-(-1)^k P(n,2k+1)). Thus

%C a(k) = 2^(-2)(P(1,1)-(-1)^k P(1,2k+1)). (End)

%C Let A be the Hessenberg matrix of order n, defined by: A[1,j]=1, A[i,i]:=-1, A[i,i-1]=-1, and A[i,j]=0 otherwise. Then, for n>=4, a(n-3)=(-1)^(n-1)*coeff(charpoly(A,x),x). - _Milan Janjic_, Jan 26 2010

%C Cantor ordering of the integers producing a 1-1 and onto correspondence between the natural numbers and the integers showing that the set Z of integers has the same cardinality as the set N of natural numbers. The cardinal of N is the first transfinite cardinal aleph_null (or aleph_naught), which is the cardinality of a given infinite set if and only it is countably infinite (denumerable), i.e., it can be put in 1-1 and onto correspondence (with a proper Cantor ordering) with the natural numbers. - _Daniel Forgues_, Jan 23 2010

%C a(n) is the determinant of the (n+2) X (n+2) (0,1)-Toeplitz matrix M satisfying: M(i,j)=0 iff i=j or i=j-1. The matrix M arises in the variation of ménage problem where not a round table, but one side of a rectangular table is considered (see comments of _Vladimir Shevelev_ in A000271). Namely M(i,j) defines the class of permutations p of 1,2,...,n+2 such that p(i)<>i and p(i)<>i+1 for i=1,2,...,n+1, and p(n+2)<>n+2. And a(n) is also the difference between the number of even and odd such permutations. - _Dmitry Efimov_, Mar 02 2017

%H T. D. Noe, <a href="/A001057/b001057.txt">Table of n, a(n) for n = 0..1000</a>

%H D. Efimov, <a href="https://arxiv.org/abs/1702.05655">Determinants of generalized binary band matrices</a>, arXiv:1702.05655 [math.RA], 2017.

%H G. Myerson and A. J. van der Poorten, <a href="https://www.jstor.org/stable/2974639">Some problems concerning recurrence sequences</a>, Amer. Math. Monthly 102 (1995), no. 8, 698-705.

%H Omar E. Pol, <a href="http://www.polprimos.com/imagenespub/polcrt01.jpg">Illustration of initial terms of A001057, A005132, A000217</a>

%H Wikipedia, <a href="http://en.wikipedia.org/wiki/1_%E2%88%92_2_%2B_3_%E2%88%92_4_%2B_%C2%B7_%C2%B7_%C2%B7">1 - 2 + 3 - 4 + ...</a>

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

%F Euler transform of [-1, 2] is sequence a(n+1). - _Michael Somos_, Jun 11 2003

%F G.f.: x / ((1 + x) * (1 - x^2)). - _Michael Somos_, Jul 20 1999

%F E.g.f.: (exp(x) - (1 - 2*x) * exp(-x)) / 4. - _Michael Somos_, Jun 11 2003

%F a(n) = 1 - 2*a(n-1) -a(n-2); a(2*n) = -n, a(2*n+1) = n+1. - _Michael Somos_, Jul 20 1999

%F |a(n+1)| = A008619(n). |a(n-1)| = A004526(n). - _Michael Somos_, Jul 20 1999

%F a(n) = -a(n-1) + a(n-2) + a(n-3). a(n) = (-1)^(n+1) * floor((n+1) / 2). - _Michael Somos_, Jun 11 2003

%F a(1) = 1, a(n) = a(n-1)+n or a(n-1)-n whichever is closer to 0 on the number line. Or abs(a(n)) = min{abs(a(n-1)+n), abs(a(n-1)-n)}. - _Amarnath Murthy_, Jul 01 2003

%F a(n) = Sum_{k=0..n} k*(-1)^(k+1). - _Paul Barry_, Aug 20 2003

%F a(n) = (1-(2n+1)*(-1)^n)/4. - _Paul Barry_, Feb 02 2004

%F a(0) = 0; a(n) = (-1)^(n-1) * (n-|a(n-1)|) for n >= 1. - _Rick L. Shepherd_, Jul 14 2004

%F a(n) = a(n-1)-n*(-1)^n, a(0)=0; or a(n) = -a(n-1)+(1-(-1)^n)/2, a(0)=0. - _Daniele Parisse_ and Franco Virga, Jun 06 2005

%F a(n) = ceiling(n/2) * (-1)^(n+1), n >= 0. - _Franklin T. Adams-Watters_, Nov 25 2011 (corrected by _Daniel Forgues_, Jul 21 2012)

%F a(n) = a(-1-n) for all n in Z. - _Michael Somos_, Jun 05 2013

%F Sum_{n>=1} 1/a(n) = 0. - _Jaume Oliver Lafont_, Jul 14 2017

%e G.f. = x - x^2 + 2*x^3 - 2*x^4 + 3*x^5 - 3*x^6 + 4*x^7 - 4*x^8 + 5*x^9 - 5*x^10 + ...

%p a := n -> (1-(-1)^n*(2*n+1))/4; # _Peter Luschny_, Jul 12 2009

%t Join[{0},Riffle[Range[35],-Range[35]]] (* _Harvey P. Dale_, Sep 21 2011 *)

%t a[ n_] := -(-1)^n Ceiling[n/2]; (* _Michael Somos_, Jun 05 2013 *)

%t LinearRecurrence[{-1, 1, 1}, {0, 1, -1}, 63] (* _Jean-François Alcover_, Jan 07 2019 *)

%o (PARI) {a(n) = if( n%2, n\2 + 1, -n/2)}; /* _Michael Somos_, Jul 20 1999 */

%o (Haskell)

%o a001057 n = (n' + m) * (-1) ^ (1 - m) where (n',m) = divMod n 2

%o a001057_list = 0 : concatMap (\x -> [x,-x]) [1..]

%o -- _Reinhard Zumkeller_, Apr 02 2012

%o (Python)

%o def a(n): return n//2 + 1 if n%2 else -n//2

%o print([a(n) for n in range(63)]) # _Michael S. Branicky_, Jul 14 2022

%Y Cf. A008619, A004526, A166711, A166871, A130472 (negation), A142150 (partial sums), A010551 (partial products for n > 0).

%Y Alternating row sums of A104578 are a(n+1), for n >= 0.

%K sign,nice,core,easy

%O 0,4

%A _N. J. A. Sloane_

%E Thanks to _Michael Somos_ for helpful comments.

%E Name edited by _Franklin T. Adams-Watters_, Jan 30 2012

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 April 18 16:22 EDT 2024. Contains 371780 sequences. (Running on oeis4.)