OFFSET
0,4
COMMENTS
If b(0)=0, b(1)=1 and b(n) = b(n-1) + (-1)^n*b(n-2), then a(n) = b(n+3). - Jaume Oliver Lafont, Oct 03 2009
a(n) is the number of palindromic compositions of n-1 into parts of 1 and 2. a(7) = 5 because we have 2+2+2, 2+1+1+2, 1+2+2+1, 1+1+2+1+1, 1+1+1+1+1+1. - Geoffrey Critzer, Mar 17 2014
a(n) is the number of palindromic compositions of n into odd parts (the corresponding generating function follows easily from Theorem 1.2 of the Hoggatt et al. reference). Example: a(7) = 5 because we have 7, 1+5+1, 3+1+3, 1+1+3+1+1, 1+1+1+1+1+1+1. - Emeric Deutsch, Aug 16 2016
The ratio of a(n)/a(n-1) oscillates between phi-1 and phi+1 as n tends to infinity, where phi is golden ratio (A001622). - Waldemar Puszkarz, Oct 10 2017
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 0..1000
Krithnaswami Alladi and V. E. Hoggatt, Jr. Compositions with Ones and Twos, Fibonacci Quarterly, 13 (1975), 233-239. - Ron Knott, Oct 29 2010
A. R. Ashrafi, J. Azarija, K. Fathalikhani, S. Klavzar, et al., Orbits of Fibonacci and Lucas cubes, dihedral transformations, and asymmetric strings, 2014.
V. E. Hoggatt, Jr., and Marjorie Bicknell, Palindromic compositions, Fibonacci Quart., Vol. 13(4), 1975, pp. 350-356.
M. A. Nyblom, Counting Palindromic Binary Strings Without r-Runs of Ones, J. Int. Seq. 16 (2013) #13.8.7
Index entries for linear recurrences with constant coefficients, signature (0,1,0,1)
FORMULA
G.f.: x*(1 + x + x^2)/(1 - x^2 - x^4).
a(n) = a(n-2) + a(n-4).
a(2n) = F(n), a(2n-1) = F(n+1) where F() is Fibonacci sequence.
a(3-n) = A051792(n).
a(3)=1, a(4)=2, a(n+2) = a(n+1) + sign(a(n) - a(n+1))*a(n), n > 4. - Benoit Cloitre, Apr 08 2002
a(0) = 0, a(1) = 1; a(2n) = a(2n-1) - a(2n-2); a(2n+1) = a(2n) + a(2n-1). - Amarnath Murthy, Jul 21 2005
MAPLE
a[0] := 0: a[1] := 1: for n from 2 to 60 do a[n] := a[n-1]-(-1)^n*a[n-2] end do: seq(a[n], n = 0 .. 50); # Emeric Deutsch, Oct 09 2017
MATHEMATICA
nn=50; CoefficientList[Series[x (1+x+x^2)/(1-x^2-x^4), {x, 0, nn}], x] (* Geoffrey Critzer, Mar 17 2014 *)
LinearRecurrence[{0, 1, 0, 1}, {0, 1, 1, 2}, 60] (* Harvey P. Dale, Nov 07 2016 *)
RecurrenceTable[{a[0]==0, a[1]==1, a[n]==a[n-1]-(-1)^n a[n-2]}, a, {n, 50}] (* Vincenzo Librandi, Oct 10 2017 *)
PROG
(PARI) a(n)=fibonacci(n\2+n%2*2)
(Magma) I:=[0, 1, 1, 2]; [n le 4 select I[n] else Self(n-2)+Self(n-4): n in [1..50]]; // Vincenzo Librandi Oct 10 2017
(SageMath) [fibonacci(n//2 + 2*(n%2)) for n in range(61)] # G. C. Greubel, Dec 06 2022
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Michael Somos, Jan 17 2000
STATUS
approved