OFFSET
1,3
COMMENTS
a(n) is a diagonal of Table A123685.
The arithmetic average of the first n terms gives the positive integers repeated (A008619). - Philippe Deléham, Nov 20 2013
Images under the modified '3x-1' map: a(n) = n/2 if n is even, (3n-1)/2 if n is odd. (In this sequence, the numbers at even indices n are n/2 [A000027], and the numbers at odd indices n are 3((n-1)/2) + 1 [A016777] = (3n-1)/2.) The latter correspondence interestingly mirrors an insight in David Bařina's 2020 paper (see below), namely that 3(n+1)/2 - 1 = (3n+1)/2. - Kevin Ge, Oct 30 2024
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
Index entries for linear recurrences with constant coefficients, signature (0,2,0,-1).
David Bařina, Convergence verification of the Collatz problem
FORMULA
From Klaus Brockhaus, May 12 2007: (Start)
G.f.: x*(1+x+2*x^2)/((1-x)^2*(1+x)^2).
a(n) = (1/4)*(4*n - 1 - (2*n - 1)*(-1)^n).
a(2n-1) = A016777(n-1) = 3(n-1) + 1.
a(2n) = A000027(n) = n.
a(n) = A071045(n-1) + 1.
a(2*n+1) + a(2*n+2) = A016825(n). - Paul Curtz, Mar 09 2011
a(n)= 2*a(n-2) - a(n-4). - Paul Curtz, Mar 09 2011
From Jaroslav Krizek, Mar 22 2011 (Start):
a(n) = n + a(n-1) for odd n; a(n) = n - A064455(n-1) for even n.
a(n) = A225126(n) for n > 1. - Reinhard Zumkeller, Apr 29 2013
a(n) = Sum_{k=1..n} (1 + (k-1)*(-1)^(k-1)). - Bruno Berselli, Jul 16 2013
a(n) = n + floor(n/2) for odd n; a(n) = n/2 for even n. - Reinhard Muehlfeld, Jul 25 2014
EXAMPLE
The natural numbers begin 1, 2, 3, ... (A000027), the sequence 3*n + 1 begins 1, 4, 7, 10, ... (A016777), therefore A123684 begins 1, 1, 4, 2, 7, 3, 10, ...
1/1 = 1, (1+1)/2 = 1, (1+1+4)/3 = 2, (1+1+4+2)/4 = 2, ... - Philippe Deléham, Nov 20 2013
MAPLE
MATHEMATICA
CoefficientList[Series[(1 +x +2*x^2)/((1-x)^2*(1+x)^2), {x, 0, 70}], x] (* Wesley Ivan Hurt, Jul 26 2014 *)
PROG
(Magma) &cat[ [ 3*n-2, n ]: n in [1..36] ]; // Klaus Brockhaus, May 12 2007
(PARI) print(vector(72, n, if(n%2==0, n/2, (3*n-1)/2))) \\ Klaus Brockhaus, May 12 2007
(PARI) print(vector(72, n, n-1/4-(1/2*n-1/4)*(-1)^n)); \\ Klaus Brockhaus, May 12 2007
(Haskell)
import Data.List (transpose)
a123684 n = a123684_list !! (n-1)
a123684_list = concat $ transpose [a016777_list, a000027_list]
-- Reinhard Zumkeller, Apr 29 2013
(Magma) /* From the fourteenth formula: */ [&+[1+k*(-1)^k: k in [0..n]]: n in [0..80]]; // Bruno Berselli, Jul 16 2013
(SageMath) [(n + (2*n-1)*(n%2))//2 for n in range(1, 71)] # G. C. Greubel, Mar 15 2024
CROSSREFS
Cf. A014682 (modified Collatz map)
KEYWORD
nonn,easy,changed
AUTHOR
Alford Arnold, Oct 11 2006
EXTENSIONS
More terms from Klaus Brockhaus, May 12 2007
STATUS
approved