login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A322132 Number of compositions of n that can be rearranged into a palindrome. 2

%I #18 Aug 13 2019 11:20:37

%S 1,1,2,2,6,8,18,26,56,90,202,320,730,1154,2592,4130,9522,15208,35330,

%T 56746,131352,212074,492570,795920,1855706,3006482,7016464,11406930,

%U 26635154,43409752,101387602,165798282,386965208,635250986,1480773866,2439516656,5678477866

%N Number of compositions of n that can be rearranged into a palindrome.

%C Equivalently, the number of compositions of n with at most one part size having odd multiplicity.

%H Alois P. Heinz, <a href="/A322132/b322132.txt">Table of n, a(n) for n = 0..1000</a> (first 201 terms from Andrew Howroyd)

%e Case n=4: The 6 compositions are: 4, 211, 121, 112, 22, 1111.

%e Case n=5: The 8 compositions are: 5, 311, 131, 113, 122, 212, 221, 11111.

%p b:= proc(n, i, p, t) option remember; `if`(n=0 or i=1,

%p `if`(t and n::odd, 0, (n+p)!/n!), add(`if`(t and j::odd,

%p 0, b(n-i*j, i-1, p+j, t or j::odd))/j!, j=0..n/i))

%p end:

%p a:= n-> b(n$2, 0, false):

%p seq(a(n), n=0..40); # _Alois P. Heinz_, Dec 02 2018

%t b[n_, i_, p_, t_] := b[n, i, p, t] = If[n == 0 || i == 1, If[t && OddQ[n], 0, (n+p)!/n!], Sum[If[t && OddQ[j], 0, b[n-i*j, i-1, p+j, t || OddQ[j]]]/ j!, {j, 0, n/i}]];

%t a[n_] := b[n, n, 0, False];

%t Table[a[n], {n, 0, 40}] (* _Jean-François Alcover_, Aug 13 2019, after _Alois P. Heinz_ *)

%o (PARI) a(n)={sum(k=0, n\2, my(p=prod(i=1, k, 1 + sum(j=1, k\i, x^(i*j)*y^(2*j)/(2*j + (i==n-2*k))!) + O(x*x^k))); subst(serlaplace(polcoef(p,k)*y^(2*k<n)), y, 1))}

%Y Cf. A130495, A322326.

%K nonn

%O 0,3

%A _Andrew Howroyd_, Nov 27 2018

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 16 04:02 EDT 2024. Contains 371696 sequences. (Running on oeis4.)