OFFSET
1,2
COMMENTS
Take natural numbers, exchange trisections starting with 2 and 4.
LINKS
Eric Weisstein's World of Mathematics, Alternating Permutations.
Reinhard Zumkeller, Illustration for A074066-A074068.
Index entries for linear recurrences with constant coefficients, signature (1,0,1,-1).
FORMULA
a(1)=1; for n>0: a(3*n-1) = 3*n+1, a(3*n) = 3*n, a(3*n+1) = 3*n-1.
a(a(n))=n (self-inverse permutation); for n>1: a(n) = n iff n == 0 modulo 3.
For n > 1: a(n) = 3*floor(n/3) + (n mod 3)^2 * (-1)^(n mod 3); a(1)=1.
a(n) = a(n-1) + a(n-3) - a(n-4) for n > 5. - Chai Wah Wu, May 25 2016
For n > 1, a(n) = n - (4/sqrt(3))*sin(2*n*Pi/3). - Wesley Ivan Hurt, Sep 29 2017
g.f.: x + x^2*(4-x-x^2+x^3) / ( (1+x+x^2)*(x-1)^2 ). - R. J. Mathar, May 22 2019
Sum_{n>=1} (-1)^(n+1)/a(n) = log(2) (A002162). - Amiram Eldar, Dec 24 2023
MATHEMATICA
a[n_] := n + Mod[n, 3]*(3*Mod[n, 3] - 5); a[1] = 1; Table[a[n], {n, 1, 69}] (* Jean-François Alcover, Nov 04 2011 *)
Join[{1}, Flatten[Reverse/@Partition[Range[2, 73], 3]]] (* Harvey P. Dale, Feb 17 2012 *)
PROG
(Haskell)
a074066 n = a074066_list !! (n-1)
a074066_list = 1 : xs where xs = 4 : 3 : 2 : map (+ 3) xs
-- Reinhard Zumkeller, Feb 21 2011
CROSSREFS
KEYWORD
nonn,easy,nice
AUTHOR
Reinhard Zumkeller, Aug 17 2002
STATUS
approved