A038608 a(n) = n*(-1)^n.
0, -1, 2, -3, 4, -5, 6, -7, 8, -9, 10, -11, 12, -13, 14, -15, 16, -17, 18, -19, 20, -21, 22, -23, 24, -25, 26, -27, 28, -29, 30, -31, 32, -33, 34, -35, 36, -37, 38, -39, 40, -41, 42, -43, 44, -45, 46, -47, 48, -49, 50, -51, 52, -53, 54, -55, 56, -57, 58, -59, 60, -61, 62, -63, 64, -65
Offset: 0
Links
- Vincenzo Librandi, Table of n, a(n) for n = 0..2000
- Tanya Khovanova, Recursive Sequences
- László Németh, The trinomial transform triangle, J. Int. Seqs., Vol. 21 (2018), Article 18.7.3. Also arXiv:1807.07109 [math.NT], 2018.
- Index entries for linear recurrences with constant coefficients, signature (-2,-1).
Programs
-
Haskell
a038608 n = n * (-1) ^ n a038608_list = [0, -1] ++ map negate (zipWith (+) a038608_list (map (* 2) $ tail a038608_list)) -- Reinhard Zumkeller, Nov 24 2012
-
Magma
[n*(-1)^n: n in [0..80]]; // Vincenzo Librandi, Jun 08 2011
-
Maple
A038608 := n->n*(-1)^n; seq(A038608(n), n=0..100);
-
Mathematica
Array[# (-1)^# &, 66, 0] (* Michael De Vlieger, Nov 18 2017 *) Table[If[EvenQ[n],n,-n],{n,0,70}] (* Harvey P. Dale, Jan 17 2022 *)
-
PARI
a(n)=n*(-1)^n \\ Charles R Greathouse IV, Dec 07 2011
-
Python
def A038608(n): return -n if n&1 else n # Chai Wah Wu, Nov 14 2022
Formula
G.f.: -x/(1+x)^2.
E.g.f: -x*exp(-x).
a(n) = -2*a(n-1) - a(n-2) for n >= 2. - Jaume Oliver Lafont, Feb 24 2009
Extensions
Edited by Frank Ellermann, Jan 28 2002
Comments