login
Reverse blocks of three in the sequence of natural numbers.
6

%I #40 Jan 31 2023 08:30:21

%S 3,2,1,6,5,4,9,8,7,12,11,10,15,14,13,18,17,16,21,20,19,24,23,22,27,26,

%T 25,30,29,28,33,32,31,36,35,34,39,38,37,42,41,40,45,44,43,48,47,46,51,

%U 50,49,54,53,52,57,56,55,60,59,58,63,62,61,66,65,64,69,68,67,72,71,70

%N Reverse blocks of three in the sequence of natural numbers.

%H Vincenzo Librandi, <a href="/A113655/b113655.txt">Table of n, a(n) for n = 1..1000</a>

%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (1,0,1,-1).

%F a(n) = 3*floor((n+2)/3) - (n-1) mod 3. - _Robert G. Wilson v_ and _Zak Seidov_, Jan 20 2006

%F a(n) = a(n-3)+3 = a(n-1)+a(n-3)-a(n-4). - _Jaume Oliver Lafont_, Dec 02 2008

%F G.f.: (3*x - x^2 - x^3 + 2*x^4)/(1 - x - x^3 + x^4) = x*(3 - x - x^2 + 2*x^3)/((1 + x + x^2)*(1-x)^2). - _Jaume Oliver Lafont_, Mar 25 2009

%F a(n) = 6*floor((n+2)/3) - n - 2. - _Dennis P. Walsh_, Aug 16 2013

%F a(n) = A000027(n) + 2 * A057078(n+2). - _Dennis P. Walsh_, Aug 16 2013

%F a(n) = n + 2 * A079918(n-1) - 2 * A079918(n). - _Dennis P. Walsh_, Aug 16 2013

%F a(n) = n - 2*A049347(n). - _Wesley Ivan Hurt_, Sep 27 2017, simplified Jun 30 2020

%F Sum_{n>=1} (-1)^(n+1)/a(n) = log(2). - _Amiram Eldar_, Jan 31 2023

%p seq(6*floor((n+2)/3)-n-2,n=1..72); # _Dennis P. Walsh_, Aug 16 2013

%t f[n_] := Switch[ Mod[n, 3], 0, n - 2, 1, n + 2, 2, n]; Array[f, 72] (* _Robert G. Wilson v_, Jan 18 2006 *)

%t LinearRecurrence[{1, 0, 1, -1}, {3, 2, 1, 6}, 100] (* or *) CoefficientList[Series[(3 - x - x^2 + 2 x^3) / ((1 + x + x^2) (1 - x)^2), {x, 0, 80}], x] (* _Vincenzo Librandi_, Sep 28 2017 *)

%t Reverse/@Partition[Range[81],3]//Flatten (* _Harvey P. Dale_, Oct 11 2020 *)

%o (PARI) a(n)=2+n-2*((n+2)%3); \\ _Jaume Oliver Lafont_, Mar 25 2009

%o (Magma) I:=[3,2,1,6]; [n le 4 select I[n] else Self(n-1)+Self(n-3)-Self(n-4): n in [1..80]]; // _Vincenzo Librandi_, Sep 28 2017

%Y Cf. A000027, A049347, A057078, A079918.

%K nonn,easy

%O 1,1

%A Parag D. Mehta (pmehta23(AT)gmail.com), Jan 16 2006

%E More terms from _Robert G. Wilson v_, Jan 18 2006