OFFSET
0,2
COMMENTS
In each group of four consecutive numbers, swap 2nd and 3rd terms. - Zak Seidov, Mar 31 2006
First differences of A089781. - Reinhard Zumkeller, Aug 15 2015
From Guenther Schrack, May 31 2017: (Start)
Permutation of the positive integers partitioned into quadruples [4k+1,4k+3,4k+2,4k+4].
Partial sums: A116996. (End)
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (1,0,0,1,-1).
FORMULA
a(n) = n+1+(i^(n(n-1))-(-1)^n)/2, where i=sqrt(-1). - Bruno Berselli, Nov 25 2012
G.f.: (2*x^3-x^2+2*x+1) / ((x-1)^2*(x+1)*(x^2+1)). - Colin Barker, Apr 30 2013
a(n) = A140081(n+2) + n. - Reinhard Zumkeller, Aug 15 2015
From Guenther Schrack, May 31 2017: (Start)
a(n) = n + 1 + ((-1)^(n*(n-1)/2) - (-1)^n)/2.
a(n) = a(n-4) + 4, n > 3.
a(n) = a(n-1) + a(n-4) - a(n-5), n > 4. (End)
Sum_{n>=0} (-1)^n/a(n) = Pi/4 + log(2)/2. - Amiram Eldar, Jan 31 2023
MAPLE
f:=proc(i) if i mod 4 = 0 then i+1 elif i mod 4 = 1 then i+2 elif i mod 4 = 2 then i else i+1; fi; end;
MATHEMATICA
b := {1, 2, 0, 1}; a[n_] := n + b[[1 + Mod[n, 4]]]; Table[a[n], {n, 0, 60}] (* Stefan Steinerberger, Mar 31 2006 *)
CoefficientList[Series[(2 x^3 - x^2 + 2 x + 1) / ((x - 1)^2 (x + 1) (x^2 + 1)), {x, 0, 40}], x] (* Vincenzo Librandi, Jun 19 2013 *)
PROG
(Maxima) makelist(n+1+(%i^(n*(n-1))-(-1)^n)/2, n, 0, 70); /* Bruno Berselli, Nov 25 2012 */
(Magma) /* By definition: */ [ n + [1, 2, 0, 1][1+(n mod 4)]: n in [0..70] ]; // Bruno Berselli, Nov 25 2012
(PARI) Vec((2*x^3-x^2+2*x+1) / ((x-1)^2*(x+1)*(x^2+1)) + O(x^66) ) \\ Joerg Arndt, Apr 30 2013
(Haskell)
a116966 n = a116966_list !! n
a116966_list = zipWith (+) [0..] $ drop 2 a140081_list
-- Reinhard Zumkeller, Aug 15 2015
CROSSREFS
KEYWORD
nonn,easy,changed
AUTHOR
N. J. A. Sloane, Mar 31 2006
STATUS
approved