OFFSET
1,2
COMMENTS
Permutation of the integers: exchange trisections starting with 2 and 3.
a(a(n)) = n. - Reinhard Zumkeller, Oct 29 2004
LINKS
Guenther Schrack, Table of n, a(n) for n = 1..10000
Index entries for linear recurrences with constant coefficients, signature (1,0,1,-1).
FORMULA
a(n) = A064429(n-1) + 1.
a(n) - n is periodic with period 3.
G.f.: x*(1+2*x-x^2+x^3)/(1-x-x^3+x^4). - Jaume Oliver Lafont, Mar 24 2009
a(0)=1, a(1)=3, a(2)=2, a(3)=4, a(n)=a(n-1)+0*a(n-2)+a(n-3)-a(n-4). - Harvey P. Dale, Mar 29 2013
a(n) = n + (2/sqrt(3))*sin(2*(n+2)*Pi/3). - Wesley Ivan Hurt, Sep 26 2017
From Guenther Schrack, Oct 23 2019: (Start)
a(n) = a(n-3) + 3 with a(1) = 1, a(2) = 3, a(3) = 2 for n > 3.
a(n) = n - (w^(2*n)*(2 + w) + w^n*(1 - w))/3 where w = (-1 + sqrt(-3))/2. (End)
Sum_{n>=1} (-1)^(n+1)/a(n) = 2*Pi/(3*sqrt(3)) - log(2)/3. - Amiram Eldar, Jan 31 2023
From Charles L. Hohn, Sep 03 2024: (Start)
a(n) = n-1+n%3.
a(n) = A375336(n-2, 1) for n >= 6. (End)
MATHEMATICA
Array[#+Mod[#+1, 3]&, 70, 0] (* or *) LinearRecurrence[{1, 0, 1, -1}, {1, 3, 2, 4}, 70] (* Harvey P. Dale, Mar 29 2013 *)
{#, #+1, #-1}[[Mod[#, 3, 1]]]&/@Range[99] (* Federico Provvedi, May 15 2021 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Benoit Cloitre, Mar 07 2003
STATUS
approved