A116966 a(n) = n + {1,2,0,1} according as n == {0,1,2,3} mod 4.
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
Offset: 0
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).
Programs
-
Haskell
a116966 n = a116966_list !! n a116966_list = zipWith (+) [0..] $ drop 2 a140081_list -- Reinhard Zumkeller, Aug 15 2015
-
Magma
/* By definition: */ [ n + [1,2,0,1][1+(n mod 4)]: n in [0..70] ]; // Bruno Berselli, Nov 25 2012
-
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 *)
-
Maxima
makelist(n+1+(%i^(n*(n-1))-(-1)^n)/2, n, 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
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
Comments