|
|
A284307
|
|
Permutation of the natural numbers partitioned into quadruples [4k-3, 4k, 4k-2, 4k-1], k > 0.
|
|
4
|
|
|
1, 4, 2, 3, 5, 8, 6, 7, 9, 12, 10, 11, 13, 16, 14, 15, 17, 20, 18, 19, 21, 24, 22, 23, 25, 28, 26, 27, 29, 32, 30, 31, 33, 36, 34, 35, 37, 40, 38, 39, 41, 44, 42, 43, 45, 48, 46, 47, 49, 52, 50, 51, 53, 56, 54, 55, 57, 60, 58, 59, 61, 64, 62, 63, 65, 68, 66, 67
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
Partition the natural number sequence into quadruples starting with (1, 2, 3, 4); swap the third and fourth element, then swap the second and third element; repeat for all quadruples.
|
|
LINKS
|
|
|
FORMULA
|
a(1)=1, a(2)=4, a(3)=2, a(4)=3, a(n) = a(n-4) + 4, n > 4.
O.g.f.: (x^4 + x^3 - 2*x^2 + 3x - 1)/(x^5 - x^4 - x + 1).
a(n) = n + ((-1)^n - (-1)^(n*(n-1)/2)*(1 + 2*(-1)^n))/2.
a(n) = n + (-1)^n*(1 - (-1)^(n*(n-1)/2) - (i^n - (-i)^n))/2.
Linear recurrence: a(n) = a(n-1) + a(n-4) - a(n-5), n > 5.
First differences, periodic: (3, -2, 1, 2), repeat.
a(n) = (2*n - 3*cos(n*Pi/2) + cos(n*Pi) + sin(n*Pi/2))/2. - Wesley Ivan Hurt, Apr 01 2017
|
|
MATHEMATICA
|
Table[n + ((-1)^n - (-1)^(n (n - 1)/2) (1 + 2 (-1)^n))/2, {n, 68}] (* Michael De Vlieger, Mar 28 2017 *)
LinearRecurrence[{1, 0, 0, 1, -1}, {1, 4, 2, 3, 5}, 70] (* or *) {#[[1]], #[[4]], #[[2]], #[[3]]}&/@Partition[Range[70], 4]//Flatten(* Harvey P. Dale, Sep 27 2017 *)
|
|
PROG
|
(MATLAB) a = [1 4 2 3];
max = (specify);
for n = 5:max
a(n) = a(n-4) + 4;
end;
(PARI) for(n=1, 68, print1(n + ((-1)^n - (-1)^(n*(n - 1)/2)*(1 + 2*(-1)^n))/2, ", ")) \\ Indranil Ghosh, Mar 29 2017
|
|
CROSSREFS
|
Subsequences:
elements with odd index: A042963(n), n > 0
indices of odd elements: A042948(n), n > 0
indices of even elements: A042964(n), n > 0
Sequence of fixed points: A016813(n-1), n > 0
Every fourth element starting at:
n=1: a(4n-3) = 4n-3 = A016813(n-1), n > 0
n=2: a(4n-2) = 4n = A008586(n), n > 0
n=3: a(4n-1) = 4n-2 = A016825(n-1), n > 0
n=4: a(4n) = 4n-1 = A004767(n-1), n > 0
Difference between pairs of elements:
a(2n+1)-a(2n-1) = A010684(n-1), n > 0
Compositions:
|
|
KEYWORD
|
nonn,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|