OFFSET
1,8
COMMENTS
A palindromic composition of a natural number m is an ordered partition of m into N+1 natural numbers (or parts), p_0, p_1, ..., p_N, of the form m = p_0 + p_1 + ... + p_N such that p_j = p_{N-j}, for each j in {0,...,N}. Two palindromic compositions, sum_{j=0..N} p_j and sum_{j=0..N} q_j (say), are identical if and only if p_j = q_j, j = 0,...,N; otherwise they are taken to be distinct.
LINKS
Alois P. Heinz, Rows n = 1..141, flattened (rows n = 1..50 from Charles R Greathouse IV)
V. E. Hoggatt, Jr., and Marjorie Bicknell, Palindromic compositions, Fibonacci Quart., Vol. 13(4), 1975, pp. 350-356.
EXAMPLE
There are eight palindromic compositions of n=7, namely, {7}, {3,1,3}, {2,3,2}, {2,1,1,1,2}, {1,5,1}, {1,2,1,2,1}, {1,1,3,1,1}, {1,1,1,1,1,1,1}, and three of them have the largest part equal to 3, so T(7,3) = 3.
Triangle T(n,k) begins:
1;
1, 1;
1, 0, 1,
1, 2, 0, 1;
1, 1, 1, 0, 1;
1, 4, 1, 1, 0, 1;
1, 2, 3, 0, 1, 0, 1;
1, 7, 3, 3, 0, 1, 0, 1;
1, 4, 6, 1, 2, 0, 1, 0, 1;
1, 12, 7, 7, 1, 2, 0, 1, 0, 1;
...
MAPLE
b:= proc(n, k) option remember; `if`(n<=k, 1, 0)+
add(b(n-2*j, k), j=1..min(k, iquo(n, 2)))
end:
T:= (n, k)-> b(n, k) -b(n, k-1):
seq(seq(T(n, k), k=1..n), n=1..14); # Alois P. Heinz, Dec 11 2013
MATHEMATICA
b[n_, k_] := b[n, k] = If[n <= k, 1, 0] + Sum[b[n-2*j, k], { j, 1, Min[k, Quotient[n, 2]]}]; t[n_, k_] := b[n, k] - b[n, k-1]; Table[Table[t[n, k], {k, 1, n}], {n, 1, 14}] // Flatten (* Jean-François Alcover, Dec 13 2013, translated from Alois P. Heinz's Maple code *)
PROG
(PARI) T(n, k, ok=0)={
if(n<1, return(n==0 && ok));
if(k>n/2 && !ok,
n-=k;
if(n<0||n%2, return(0));
return(2^max(n/2-1, 0))
);
sum(i=1, k,
T(n-2*i, k, ok||i==k)
)+(n==k || (ok && n<k))
}; \\ Charles R Greathouse IV, Dec 11 2013
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
L. Edson Jeffery, Dec 10 2013
STATUS
approved