OFFSET
0,4
COMMENTS
The asymmetry degree of a finite sequence of numbers is defined to be the number of pairs of symmetrically positioned distinct entries. Example: the asymmetry degree of (2,7,6,4,5,7,3) is 2, counting the pairs (2,3) and (6,5).
A sequence is palindromic if and only if its asymmetry degree is 0.
LINKS
Colin Barker, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (1,2,1,-2,-3,-1).
FORMULA
G.f.: g(z) = 2z^3/((1+z+z^2)(1-z-z^2)^2). In the more general situation of compositions into a[1]<a[2]<a[3]<..., denoting F(z) = Sum(z^{a[j]},j>=1}, we have g(z)=(F(z)^2-F(z^2))/((1+F(z))(1-F(z))^2).
a(n) = (n+1)/2-(3/2)*floor((n+2)/3)+(3/5)*(n+1)f(n)-(1/10)*(2n+5)f(n+1), where f(j)= A000045(j) are the Fibonacci numbers.
a(n) = Sum_{k>=0} k*A275438(n,k).
EXAMPLE
a(5) = 6 because the compositions of 5 with parts in {1,2} are 122, 212, 221, 1112, 1121, 1211, 2111, and 11111 and the sum of their asymmetry degrees is 1 + 0 + 1 + 1 + 1 + 1 + 1 + 0 = 6.
MAPLE
f := n -> combinat:-fibonacci(n):
a := n -> (n+1)/2-(3/2)*floor((n+2)/3)+(3/5)*(n+1)*f(n)-(1/10)*(2*n+5)*f(n+1):
seq(a(n), n = 0..40);
# alternative program:
g := 2*z^3/((1+z+z^2)*(1-z-z^2)^2):
gser := series(g, z=0, 45):
seq(coeff(gser, z, n), n = 0..40);
MATHEMATICA
Join[{0}, Table[Total@ Map[Total, Map[BitXor[Take[# - 1, Ceiling[Length[#]/2]], Reverse@ Take[# - 1, -Ceiling[Length[#]/2]]] &,
Flatten[Map[Permutations, DeleteCases[IntegerPartitions@ n, {a_, ___} /; a > 2]], 1]]], {n, 30}]] (* Michael De Vlieger, Aug 17 2016 *)
PROG
(PARI) concat(vector(3), Vec(2*x^3/((1+x+x^2)*(1-x-x^2)^2) + O(x^50))) \\ Colin Barker, Aug 28 2016
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Emeric Deutsch, Aug 16 2016
STATUS
approved