

A116966


a(n) = n + {1,2,0,1} according as n == {0,1,2,3} mod 4.


11



1, 3, 2, 4, 5, 7, 6, 8, 9, 11, 10, 12, 13, 15, 14, 16, 17, 19, 18, 20, 21, 23, 22, 24, 25, 27, 26, 28, 29, 31, 30, 32, 33, 35, 34, 36, 37, 39, 38, 40, 41, 43, 42, 44, 45, 47, 46, 48, 49, 51, 50, 52, 53, 55, 54, 56, 57, 59, 58, 60, 61, 63, 62, 64, 65, 67, 66, 68
(list;
graph;
refs;
listen;
history;
text;
internal format)



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(n1))(1)^n)/2, where i=sqrt(1).  Bruno Berselli, Nov 25 2012
G.f.: (2*x^3x^2+2*x+1) / ((x1)^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*(n1)/2)  (1)^n)/2.
a(n) = a(n4) + 4, n > 3.
a(n) = a(n1) + a(n4)  a(n5), n > 4. (End)


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*(n1))(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^3x^2+2*x+1) / ((x1)^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

Cf. A115391.
Cf. A140081, A089781.
Sequence in context: A039906 A056011 A117123 * A182187 A163241 A234027
Adjacent sequences: A116963 A116964 A116965 * A116967 A116968 A116969


KEYWORD

nonn,easy


AUTHOR

N. J. A. Sloane, Mar 31 2006


STATUS

approved



