login
a(n) = a(n-1) + a(n-2) + 1 if n is a multiple of 6, otherwise a(n) = a(n-1) + a(n-2).
3

%I #52 Jan 25 2023 11:51:48

%S 1,1,2,3,5,8,14,22,36,58,94,152,247,399,646,1045,1691,2736,4428,7164,

%T 11592,18756,30348,49104,79453,128557,208010,336567,544577,881144,

%U 1425722,2306866,3732588,6039454,9772042,15811496,25583539,41395035,66978574,108373609

%N a(n) = a(n-1) + a(n-2) + 1 if n is a multiple of 6, otherwise a(n) = a(n-1) + a(n-2).

%C Also: convolution of A000045 with the period-6 sequence (0,0,0,0,0,0, 1,...). - _R. J. Mathar_, May 30 2008

%C Sequences of the form s(0)=a, s(1)= b, s(n) = s(n-1) + s(n-2) + k if n mod m = p, else s(n) = s(n-1) + s(n-2) have a form s(n) = fibonacci(n-1)*a + fibonacci(n)*b + P(x)*k. a(n) is the P(x) sequence for m=6. s(n) = fib(n)*a + fib(n-1)*b + a(n-6-p)*k. - _Gary Detlefs_, Dec 05 2010

%C a(n) is the number of compositions of n where the order of the 2 and the 3 does not matter. - _Gregory L. Simay_, May 18 2017

%H H. Matsui et al., <a href="http://www.fq.math.ca/Problems/elementary45-2.pdf">Problem B-1035</a>, Fibonacci Quarterly, Vol. 45, Number 2; 2007; p. 182.

%H <a href="/index/Rec#order_08">Index entries for linear recurrences with constant coefficients</a>, signature (1,1,0,0,0,1,-1,-1).

%F O.g.f.: 1/((1-x^6)(1 - x - x^2)). - _R. J. Mathar_, May 30 2008

%F a(n) = ((-1)^n-1)/6 + A099837(n+3)/12 + A000045(n+4)/4 + A057079(n)/12. - _R. J. Mathar_, Dec 07 2010

%F a(n) = floor(A066983(n+4)/3). - _Gary Detlefs_, Dec 19 2010

%F a(n) = round((1 + sqrt(5))/8 A000045(n+3)). - _John M. Campbell_, Jul 06 2016

%F a(n) = (number of compositions of n consisting of only 1 or 2 or 6) - (number of compositions with only 7 or ((1 or 2) and 7)) - (number of compositions with only 8 or ((1 or 2) and 8)). The "or" is inclusive. - _Gregory L. Simay_, May 25 2017

%e Since 5 is not a multiple of 6, a(5) = a(4) + a(3) = 5 + 3 = 8. Since 6 is a multiple of 6, a(6) = a(5) + a(4) + 1 = 8 + 5 + 1 = 14. - _Michael B. Porter_, Jul 26 2016

%p A131132:=proc(n) option remember; local t1; if n <= 2 then RETURN(1); fi: if n mod 6 = 1 then t1:=1 else t1:=0; fi: procname(n-1)+procname(n-2)+t1; end; [seq(A131132(n), n=1..100)]; # _N. J. A. Sloane_, May 25 2008; Typo corrected by _R. J. Mathar_, May 30 2008

%t Print[Table[Round[(1 + Sqrt[5])/8 Fibonacci[n + 3]], {n, 0, 50}]] ;

%t Print[RecurrenceTable[{c[n] == c[n - 1] + c[n - 2] + c[n - 6] - c[n - 7] - c[n - 8], c[0] == 1, c[1] == 1, c[2] == 2, c[3] == 3, c[4] == 5, c[5] == 8, c[6] == 14, c[7] == 22}, c, {n, 0, 50}]] ; (* _John M. Campbell_, Jul 07 2016 *)

%t LinearRecurrence[{1, 1, 0, 0, 0, 1, -1, -1}, {1, 1, 2, 3, 5, 8, 14, 22}, 40] (* _Vincenzo Librandi_, Jul 07 2016 *)

%Y Cf. A052952, A004695, A080239, A124502, A066983.

%K nonn

%O 0,3

%A _N. J. A. Sloane_, May 25 2008

%E More specific name from _R. J. Mathar_, Dec 09 2009