A123638 Consider the 2^n compositions of n and count only those ending in an odd part with row sum A001045.
1, 1, 3, 8, 25, 83, 299, 1158, 4813, 21373, 100955, 504916, 2662761, 14754311, 85643459, 519493938, 3285790317, 21628225041, 147887079907, 1048634836288, 7698589399833, 58432476430139, 457901993065915, 3700291495531166
Offset: 1
Keywords
Examples
4 31 32 33 211 221 222 1111 Consider the above multisets: permute and note the parity of the ending part of each of the 14 compositions. 4 31 13 32 23 33 211 121 112 221 212 122 222 1111 4 is even 31 13 23 and 33 are odd 32 is even etc there are 0 + 4 + 3 + 1 = 8 odd compositions therefore a(4)=8.
Programs
-
Maple
g:= proc(b,t,l,m) option remember; if t=0 then b*l else add (g(b, t-1, irem(k, 2), m), k=1..m-1) +g(1, t-1, irem(m, 2), m) fi end: a:= n-> add (g(0, k, 0, n+1-k), k=1..n): seq (a(n), n=1..30);
-
Mathematica
g[b_, t_, l_, m_] := g[b, t, l, m] = If[t == 0 , b*l , Sum[g[b, t-1, Mod[k, 2], m], {k, 1, m-1}] + g[1, t-1, Mod[m, 2], m]]; a[n_] := Sum[g[0, k, 0, n+1-k], {k, 1, n}]; Table[a[n], {n, 1, 30}] (* Jean-François Alcover, Nov 04 2013, translated from Alois P. Heinz's Maple program *)
Extensions
Offset corrected, Maple program and more terms added by Alois P. Heinz, Nov 06 2009
Comments