A141310 The odd numbers interlaced with the constant-2 sequence.
1, 2, 3, 2, 5, 2, 7, 2, 9, 2, 11, 2, 13, 2, 15, 2, 17, 2, 19, 2, 21, 2, 23, 2, 25, 2, 27, 2, 29, 2, 31, 2, 33, 2, 35, 2, 37, 2, 39, 2, 41, 2, 43, 2, 45, 2, 47, 2, 49, 2, 51, 2, 53, 2, 55, 2, 57, 2, 59, 2, 61, 2, 63, 2, 65, 2, 67, 2, 69, 2, 71, 2, 73, 2, 75, 2, 77, 2, 79, 2, 81, 2, 83, 2, 85, 2, 87, 2, 89, 2, 91, 2, 93, 2, 95, 2, 97
Offset: 0
Links
- Antti Karttunen, Table of n, a(n) for n = 0..16384
- Eric Weisstein's World of Mathematics, Gear Graph.
- Eric Weisstein's World of Mathematics, Minimum Total Dominating Set.
- Eric Weisstein's World of Mathematics, Sun Graph.
- Index entries for linear recurrences with constant coefficients, signature (0,2,0,-1).
Crossrefs
Programs
-
Maple
a:= n-> n+1-(n-1)*(n mod 2): seq(a(n), n=0..96); # Wesley Ivan Hurt, Jun 05 2013
-
Mathematica
Flatten[Table[{2 n - 1, 2}, {n, 40}]] (* Alonso del Arte, Jun 15 2013 *) Riffle[Range[1, 79, 2], 2] (* Alonso del Arte, Jun 14 2013 *) Table[((-1)^n (n - 1) + n + 3)/2, {n, 0, 20}] (* Eric W. Weisstein, Apr 11 2018 *) Table[Floor[(n + 1)/2]/(n + 1), {n, 0, 20}] // Denominator (* Eric W. Weisstein, Apr 11 2018 *) LinearRecurrence[{0, 2, 0, -1}, {2, 3, 2, 5}, {0, 20}] (* Eric W. Weisstein, Apr 11 2018 *) CoefficientList[Series[(1 + 2 x + x^2 - 2 x^3)/(-1 + x^2)^2, {x, 0, 20}], x] (* Eric W. Weisstein, Apr 11 2018 *)
-
PARI
A141310(n) = if(n%2,2,1+n); \\ (for offset=0 version) - Antti Karttunen, Oct 02 2018
-
PARI
A141310off1(n) = if(n%2,n,2); \\ (for offset=1 version) - Antti Karttunen, Oct 02 2018
-
Python
def A141310(n): return 2 if n % 2 else n + 1 # Chai Wah Wu, May 24 2022
Formula
a(2n) = A005408(n). a(2n+1) = 2.
First differences: a(n+1) - a(n) = (-1)^(n+1)*A109613(n-1), n > 0.
a(n) = 2*a(n-2) - a(n-4). - R. J. Mathar, Feb 23 2009
G.f.: (1+2*x+x^2-2*x^3)/((x-1)^2*(1+x)^2). - R. J. Mathar, Feb 23 2009
From Wesley Ivan Hurt, Jun 05 2013: (Start)
a(n) = n + 1 - (n - 1)*(n mod 2).
a(n) = (n + 1) * (n - floor((n+1)/2))! / floor((n+1)/2)!.
Extensions
Edited by R. J. Mathar, Feb 23 2009
Term a(45) corrected, and more terms added by Antti Karttunen, Oct 02 2018
Comments