A138750 a(n) = ceiling(n/2) if n == 2 (mod 3), a(n) = 2n otherwise.
0, 2, 1, 6, 8, 3, 12, 14, 4, 18, 20, 6, 24, 26, 7, 30, 32, 9, 36, 38, 10, 42, 44, 12, 48, 50, 13, 54, 56, 15, 60, 62, 16, 66, 68, 18, 72, 74, 19, 78, 80, 21, 84, 86, 22, 90, 92, 24, 96, 98, 25, 102, 104, 27, 108, 110, 28, 114, 116, 30, 120, 122, 31, 126, 128, 33, 132, 134, 34
Offset: 0
Examples
a(0) = 2*0 = 0, a(1) = 2*1 = 2, a(3) = 2*3 = 6, a(4) = 2*4 = 8, ... since these indices are not congruent to 2 (mod 3). a(2) = ceiling(2/2) = 1, a(5) = ceiling(5/2) = 3, a(8) = ceiling(8/2) = 4, a(11) = ceiling(11/2) = 6, ... since these indices are congruent to 2 (mod 3).
Links
- Index entries for linear recurrences with constant coefficients, signature (0,0,1,0,0,1,0,0,-1).
- Index entries for sequences related to 3x+1 (or Collatz) problem.
Crossrefs
Programs
-
Mathematica
Table[If[Mod[n,3]==2,Ceiling[n/2],2n],{n,0,70}] (* or *) LinearRecurrence[{0,0,1,0,0,1,0,0,-1},{0,2,1,6,8,3,12,14,4},70] (* Harvey P. Dale, Nov 20 2013 *)
-
PARI
A138750(n) = if( n%3==2, ceil(n/2), 2*n )
Formula
G.f.: x*(2 + x + 6*x^2 + 6*x^3 + 2*x^4 + 6*x^5 + 4*x^6) / ( (1+x)*(x^2-x+1)*(x-1)^2*(1+x+x^2)^2 ). - R. J. Mathar, Oct 16 2013
a(n) = a(n-3) + a(n-6) - a(n-9); a(0)=0, a(1)=2, a(2)=1, a(3)=6, a(4)=8, a(5)=3, a(6)=12, a(7)=14, a(8)=4. - Harvey P. Dale, Nov 20 2013
Sum_{n>=1} (-1)^n/a(n) = log(3)/2 - log(2)/3 = log(27/4)/6. - Amiram Eldar, Jul 26 2024
Comments