login
A330396
Permutation of the nonnegative integers partitioned into triples [3*k+2, 3*k+1, 3*k] for k >= 0.
5
2, 1, 0, 5, 4, 3, 8, 7, 6, 11, 10, 9, 14, 13, 12, 17, 16, 15, 20, 19, 18, 23, 22, 21, 26, 25, 24, 29, 28, 27, 32, 31, 30, 35, 34, 33, 38, 37, 36, 41, 40, 39, 44, 43, 42, 47, 46, 45, 50, 49, 48, 53, 52, 51, 56, 55, 54, 59, 58, 57, 62, 61, 60, 65, 64, 63, 68, 67, 66, 71, 70, 69, 74, 73, 72, 77, 76, 75, 80, 79, 78, 83, 82
OFFSET
0,1
COMMENTS
Partition the nonnegative integer sequence into triples starting with (0,1,2); transpose the first and third elements of the triple, repeat for all triples.
A self-inverse sequence: a(a(n)) = n.
The sequence is an interleaving of A016789 with A016777 and with A008585, in that order.
FORMULA
G.f.: (2 - x - x^2 + 3*x^3)/((x-1)^2*(1 + x + x^2)). [corrected by Georg Fischer, Apr 17 2020]
Linear recurrence: a(n) = a(n-1) + a(n-3) - a(n-4) for n > 4.
Simple recursion: a(n) = a(n-3) + 3 for n > 2 with a(0) = 2, a(1) = 1, a(2) = 0.
Negative domain: a(-n) = -(a(n-1) + 1).
Explicit formulas:
a(n) = n + 2 - 2*(n mod 3).
a(n) = 2 - n + 6*floor(n/3).
a(n) = n + 2*(w^(2*n)*(2 + w) + w^n*(1 - w))/3 where w = (-1 + sqrt(-3))/2.
PROG
(MATLAB) a = zeros(1, 10000);
w = (-1+sqrt(-3))/2;
fprintf('0 2\n');
for n = 1:10000
a(n) = int64((3*n + 2*w^(2*n)*(w + 2) + 2*w^n*(1 - w))/3);
fprintf('%i %i\n', n, a(n));
end
CROSSREFS
Fixed point sequence: A016777.
Relationships:
a(n) = a(n-1) - 1 + 6*A079978(n).
a(n) = 2*a(n-1) - a(n-2) + 6*A049347(n).
a(n) = A074066(n+2) - 2.
a(n) = A113655(n+1) - 1.
Sequence in context: A066435 A261301 A171960 * A182376 A030206 A212768
KEYWORD
nonn
AUTHOR
Guenther Schrack, Mar 03 2020
STATUS
approved