%I #83 May 04 2023 17:33:17
%S 1,0,2,2,5,8,15,26,46,80,139,240,413,708,1210,2062,3505,5944,10059,
%T 16990,28646,48220,81047,136032,228025,381768,638450,1066586,1780061,
%U 2968040,4944519,8230370,13689118,22751528,37786915,62716752,104028245
%N Number of binary vectors of length n+1 beginning with 0 and containing just 1 singleton.
%C Number of compositions of n+1 containing exactly one 1. - _Emeric Deutsch_, Mar 08 2002
%C Number of permutations with one fixed point avoiding 231 and 321.
%C A singleton is a run of length 1. - _Michael Somos_, Nov 29 2014
%C Second column of A105422. - _Michael Somos_, Nov 29 2014
%C Number of weak compositions of n with one 0 and no 1's. Example: Combine one 0 with the compositions of 5 without 1 to get a(5) = 8 weak compositions: 0,5; 5,0; 0,2,3; 0,3,2; 2,0,3; 3,0,2; 2,3,0; 3,2,0. - _Gregory L. Simay_, Mar 21 2018
%H Vincenzo Librandi, <a href="/A006367/b006367.txt">Table of n, a(n) for n = 0..1000</a>
%H Ricardo Gómez Aíza, <a href="https://arxiv.org/abs/2009.02669">Symbolic dynamical scales: modes, orbitals, and transversals</a>, arXiv:2009.02669 [math.DS], 2020.
%H Jia Huang, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL26/Huang/huang8.html">Partially Palindromic Compositions</a>, J. Int. Seq. (2023) Vol. 26, Art. 23.4.1. See pp. 4, 11.
%H Mengmeng Liu and Andrew Yezhou Wang, <a href="https://www.emis.de/journals/JIS/VOL23/Wang/wang61.html">The Number of Designated Parts in Compositions with Restricted Parts</a>, J. Int. Seq., Vol. 23 (2020), Article 20.1.8.
%H J. J. Madden, <a href="http://arxiv.org/abs/1707.04351">A generating function for the distribution of runs in binary words</a>, arXiv:1707.04351 [math.CO], 2017, Theorem 1.1, r=k=1.
%H T. Mansour and A. Robertson, <a href="https://arxiv.org/abs/math/0204005">Refined restricted permutations avoiding subsets of patterns of length three</a>, arXiv:math/0204005 [math.CO], 2002.
%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (2,1,-2,-1).
%F a(n) = a(n-1) + a(n-2) + Fibonacci(n-3).
%F G.f.: (1-x)^2/(1-x-x^2)^2. - _Emeric Deutsch_, Mar 08 2002
%F a(n) = A010049(n+1) - A010049(n). - _R. J. Mathar_, May 30 2014
%F Convolution square of A212804. - _Michael Somos_, Nov 29 2014
%F a(n) = -(-1)^n * A004798(-1-n) for all n in Z. - _Michael Somos_, Nov 29 2014
%F 0 = a(n)*(-2*a(n) - 7*a(n+1) + 2*a(n+2) + a(n+3)) + a(n+1)*(-4*a(n+1) + 10*a(n+2) - 2*a(n+3)) + a(n+2)*(+4*a(n+2) - 7*a(n+3)) + a(n+3)*(+2*a(n+3)) for all n in Z. - _Michael Somos_, Nov 29 2014
%F a(n) = (n*Lucas(n-2) + Fibonacci(n))/5 + Fibonacci(n-1). - _Ehren Metcalfe_, Jul 29 2017
%e a(4) = 5 because among the 2^4 compositions of 5 only 4+1,1+4,2+2+1,2+1+2,1+2+2 contain exactly one 1.
%e a(4) = 5 because the binary vectors of length 4+1 beginning with 0 and with exactly one singleton are: 00001, 00100, 00110, 01100, 01111. - _Michael Somos_, Nov 29 2014
%e G.f. = 1 + 2*x^2 + 2*x^3 + 5*x^4 + 8*x^5 + 15*x^6 + 26*x^7 + 46*x^8 + ...
%t nn=36; CoefficientList[Series[1/(1 -x/(1-x) +x)^2, {x, 0, nn}], x] (* _Geoffrey Critzer_, Feb 18 2014 *)
%t a[n_]:= If[ n<0, SeriesCoefficient[((1-x)/(1+x-x^2))^2, {x, 0, -2-n}], SeriesCoefficient[((1-x)/(1-x-x^2))^2, {x, 0, n}]]; (* _Michael Somos_, Nov 29 2014 *)
%o (Magma) I:=[1,0]; [n le 2 select I[n] else Self(n-1)+Self(n-2)+Fibonacci(n-3): n in [1..40]]; // _Vincenzo Librandi_, Feb 20 2014
%o (PARI) Vec( (1-x)^2/(1-x-x^2)^2 + O(x^66) ) \\ _Joerg Arndt_, Feb 20 2014
%o (PARI) {a(n) = if( n<0, n = -2-n; polcoeff( (1 - x)^2 / (1 + x - x^2)^2 + x * O(x^n), n), polcoeff( (1 - x)^2 / (1 - x - x^2)^2 + x * O(x^n), n))}; /* _Michael Somos_, Nov 29 2014 */
%o (Python)
%o from sympy import fibonacci
%o from sympy.core.cache import cacheit
%o @cacheit
%o def a(n): return 1 if n==0 else 0 if n==1 else a(n - 1) + a(n - 2) + fibonacci(n - 3)
%o print([a(n) for n in range(51)]) # _Indranil Ghosh_, Jul 20 2017
%o (SageMath)
%o def A006367(n): return (1/5)*(n*lucas_number2(n-2, 1, -1) + fibonacci(n+1) + 4*fibonacci(n-1))
%o [A006367(n) for n in (0..40)] # _G. C. Greubel_, Apr 06 2022
%Y Cf. A000032, A000045, A004798, A006355, A010049, A105422, A139821, A212804.
%K nonn,easy
%O 0,3
%A David M. Bloom