A330396 Permutation of the nonnegative integers partitioned into triples [3*k+2, 3*k+1, 3*k] for k >= 0.
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
Keywords
Links
Crossrefs
Programs
-
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
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.
Comments