OFFSET
0,1
COMMENTS
Many pairs of primes of the form p+6 (5,11 - 13,19 - 17,23 - 37,43 - 41,47 - 53,59 - 61,67 - 73,79 - 97,103 - 101,107 - and so on).
a(n) is A005408(n) = 1+2*n swapped by pairs. - Paul Curtz, Mar 07 2011
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (1,1,-1).
FORMULA
a(n) = 4*n - a(n-1), n >= 1.
G.f.: ( 3-2*x+3*x^2 ) / ( (1+x)*(1-x)^2 ). - R. J. Mathar, Nov 02 2011
a(n) = a(n-1) + a(n-2) - a(n-3). - Vincenzo Librandi, Dec 01 2012
E.g.f.: (1 + 2*x)*exp(x) + 2*exp(-x). - G. C. Greubel, May 16 2016
Sum_{n>=0} (-1)^(n+1)/a(n) = Pi/4. - Amiram Eldar, Mar 02 2023
MATHEMATICA
Table[1 + 2*(-1)^n + 2*n, {n, 0, 100}] (* Vincenzo Librandi, Dec 01 2012 *)
LinearRecurrence[{1, 1, -1}, {3, 1, 7}, 70] (* Harvey P. Dale, Jan 16 2023 *)
PROG
(Magma) [1 + 2*(-1)^n + 2*n: n in [0..70]]; // Vincenzo Librandi, Dec 01 2012
(PARI) vector(100, n, n--; 1 + 2*(-1)^n + 2*n) \\ Altug Alkan, Oct 19 2015
(SageMath)
def A166519(n): return 4*((n+1)%2) + 2*n -1
[A166519(n) for n in range(101)] # G. C. Greubel, Aug 03 2024
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Vincenzo Librandi, Oct 16 2009
STATUS
approved