OFFSET
1,1
COMMENTS
This sequence is a permutation of the positive integers, where each a(n) is the smallest positive integer not occurring earlier in the sequence such that the m-th term of the inverse permutation A130509 never equals a(m), for all positive integers m.
LINKS
Index entries for linear recurrences with constant coefficients, signature (1,0,1,-1).
FORMULA
a(1)=2, a(2)=3, a(3)=1, a(4)=5, a(n)=a(n-1)+a(n-3)-a(n-4). - Harvey P. Dale, Feb 02 2015
a(n) = n - 2*cos(2*n*Pi/3). - Wesley Ivan Hurt, Sep 27 2017
G.f.: x*(2+x-2*x^2+2*x^3) / ( (1+x+x^2)*(x-1)^2 ). - R. J. Mathar, Oct 03 2021
Sum_{n>=1} (-1)^(n+1)/a(n) = 2*Pi/(3*sqrt(3)) - log(2)/3. - Amiram Eldar, Jan 31 2023
MATHEMATICA
Transpose[NestList[{#[[2]], #[[3]], #[[1]]+3}&, {2, 3, 1}, 100]][[1]] (* Harvey P. Dale, Sep 08 2011 *)
LinearRecurrence[{1, 0, 1, -1}, {2, 3, 1, 5}, 100] (* Harvey P. Dale, Feb 02 2015 *)
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Leroy Quet, Jun 01 2007
STATUS
approved