OFFSET
1,3
COMMENTS
Unlike Recamán's sequence, this one has "simple" behavior since the sequence of signs of a(n+1)-a(n) becomes 4-periodic sequence -1,-1,1,1,-1,-1,1,1,-1,-1,...
FORMULA
With phi=(1+sqrt(5))/2 for n>1 : a(4n)=floor(r*phi^(4n)) where r = (-675+327*sqrt(5))/90; a(4n+1)=floor(s*phi^(4n+1)) where s=(-132+66*sqrt(5))/18; a(4n+2)=floor(s*phi^(4n+2)) where t= (-15+7*sqrt(5))/2; a(4n+3)=floor(u*phi^(4n+3)) where u=(-115+52*sqrt(5))/15.
For n>=0, a(4n+5) = 11/3*Luc(4n+2), a(4n+6) = 5*Fib(4n+2).
For n>=3, the sequence satisfies the order 8 linear recurrence: a(n+8)-7*a(n+4)+a(n)=0. - Benoit Cloitre, Apr 30 2006
Empirical g.f.: x*(6*x^7-4*x^6+17*x^5-12*x^4+3*x^3-5*x^2-1) / ((x^2+x-1)*(x^4+3*x^2+1)). - Colin Barker, Jun 26 2013
EXAMPLE
a(6)+a(5)=5+11=16 and F(7)=13. Since 16-13=3 is not already in the sequence, a(7)= a(6)+a(5)-F(7)=3.
PROG
(PARI) m=200; a=vector(m); a[1]=1; a[2]=1; for(n=3, m, a[n]=if(n<0, 0, if(abs(sign(a[n-1]+a[n-2]-fibonacci(n))-1)+setsearch(Set(vector(n-1, i, a[i])), a[n-1]+a[n-2]-fibonacci(n)), a[n-1]+a[n-2]+fibonacci(n), a[n-1]+a[n-2]-fibonacci(n)))); a
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Benoit Cloitre, Mar 03 2004
EXTENSIONS
PARI code corrected by Colin Barker, Jun 26 2013
STATUS
approved