A289249 Number of compositions of n if only the order of parts 1 and 2 matters.
1, 1, 2, 4, 7, 12, 21, 35, 59, 98, 162, 266, 437, 713, 1163, 1893, 3077, 4995, 8105, 13139, 21293, 34492, 55858, 90438, 146406, 236974, 383538, 620703, 1004471, 1625447, 2630249, 4256087, 6886804, 11143447, 18030911, 29175137, 47206975, 76383199, 123591458
Offset: 0
Keywords
Examples
For n=6, the 21 sequences counted are [6]; [5],1; [4],2; [3,3], [4],1,1; [3],2,1; [3],1,2; 2,2,2; [3],1,1,1; 2,2,1,1; 2,1,2,1; 1,2,2,1; 1,2,1,2; 1,1,2,2; 2,1,1,2; 2,1,1,1,1; 1,2,1,1,1; 1,1,2,1,1; 1,1,1,2,1; 1,1,1,1,2; and 1,1,1,1,1,1.
Programs
-
Mathematica
Table[PartitionsP[n] + Sum[Fibonacci[k] PartitionsP[n - 2 - k], {k, n - 2}], {n, 0, 50}] (* Indranil Ghosh, Jun 29 2017 *)
-
PARI
a275388(n)=sum(k=1, n, fibonacci(k)*numbpart(n - k)); a(n)=numbpart(n)+a275388(n - 2); \\ Indranil Ghosh, Jun 29 2017
-
Python
from sympy import fibonacci, npartitions def a(n): return npartitions(n) + sum([fibonacci(k)*npartitions(n - 2 - k) for k in range(1, n - 1)]) print([a(n) for n in range(51)]) # Indranil Ghosh, Jun 29 2017
Formula
Extensions
More terms from Indranil Ghosh, Jun 29 2017
Comments