login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A166519
a(n) = 1 + 2*(-1)^n + 2*n.
15
3, 1, 7, 5, 11, 9, 15, 13, 19, 17, 23, 21, 27, 25, 31, 29, 35, 33, 39, 37, 43, 41, 47, 45, 51, 49, 55, 53, 59, 57, 63, 61, 67, 65, 71, 69, 75, 73, 79, 77, 83, 81, 87, 85, 91, 89, 95, 93, 99, 97, 103, 101, 107, 105, 111, 109, 115, 113, 119, 117, 123, 121, 127, 125, 131, 129, 135
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
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
Cf. A005408.
Sequence in context: A071043 A375584 A101624 * A213043 A319740 A275662
KEYWORD
nonn,easy
AUTHOR
Vincenzo Librandi, Oct 16 2009
STATUS
approved