login
Permutation of the nonnegative integers: [6k+3, 6k+4, 6k+5, 6k, 6k+1, 6k+2, ...].
2

%I #22 Dec 25 2023 01:52:01

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

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

%U 52,53,48,49,50,57,58,59,54,55,56,63,64,65,60,61,62,69

%N Permutation of the nonnegative integers: [6k+3, 6k+4, 6k+5, 6k, 6k+1, 6k+2, ...].

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

%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>.

%F G.f.: (3-2*x-3*x^3+4*x^4) / ((x-1)^2*(1+x^3)).

%F a(n) = 2*a(n-1) - a(n-2) - a(n-3) + 2*a(n-4) - a(n-5), n>4.

%F a(n) = n + 3*(-1)^floor(n/3).

%F a(n) = a(n-6) + 6 for n>5. - _Tom Edgar_, Oct 28 2015

%F From _Wesley Ivan Hurt_, Nov 22 2015: (Start)

%F a(n) = n + 3*A130151(n).

%F a(3n) = 3*A004442(n). (End)

%F Sum_{n>=0, n!=3} (-1)^n/a(n) = log(2) (A002162). - _Amiram Eldar_, Dec 25 2023

%p A263824:=n->n+3*(-1)^floor(n/3): seq(A263824(n), n=0..100);

%t Table[n + 3 (-1)^Floor[n/3], {n, 0, 100}]

%t CoefficientList[Series[(3 - 2 x - 3 x^3 + 4 x^4)/((x - 1)^2 (1 + x^3)), {x, 0, 70}], x] (* _Vincenzo Librandi_, Nov 22 2015 *)

%t LinearRecurrence[{2,-1,-1,2,-1},{3,4,5,0,1},70] (* _Harvey P. Dale_, Jun 23 2017 *)

%o (Magma) [n+3*(-1)^Floor(n/3) : n in [0..100]];

%o (PARI) Vec((3-2*x-3*x^3+4*x^4) / ((x-1)^2*(1+x^3)) + O(x^100)) \\ _Altug Alkan_, Oct 28 2015

%o (Magma) I:=[3,4,5,0,1]; [n le 5 select I[n] else 2*Self(n-1)- Self(n-2)-Self(n-3)+2*Self(n-4)-Self(n-5): n in [1..70]]; // _Vincenzo Librandi_, Nov 22 2015

%o (PARI) A263824(n)=n+3*(-1)^(n\3) \\ _M. F. Hasler_, Nov 25 2015

%Y Cf. A002162, A004442, A130151, A279318.

%K nonn,easy

%O 0,1

%A _Wesley Ivan Hurt_, Oct 27 2015