The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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!)
A309938 Triangle read by rows: T(n,k) is the number of compositions of n with k parts and differences all equal to 1 or -1. 8
1, 1, 0, 1, 2, 0, 1, 0, 1, 0, 1, 2, 1, 0, 0, 1, 0, 2, 2, 0, 0, 1, 2, 1, 0, 1, 0, 0, 1, 0, 1, 4, 1, 0, 0, 0, 1, 2, 2, 0, 3, 2, 0, 0, 0, 1, 0, 1, 4, 2, 0, 1, 0, 0, 0, 1, 2, 1, 0, 3, 6, 1, 0, 0, 0, 0, 1, 0, 2, 4, 3, 0, 4, 2, 0, 0, 0, 0, 1, 2, 1, 0, 3, 8, 3, 0, 1, 0, 0, 0, 0 (list; table; graph; refs; listen; history; text; internal format)
OFFSET
1,5
COMMENTS
Parts will alternate between being odd and even. For even k, a composition cannot be the same as its reversal and therefore for even k, T(n,k) is even.
LINKS
EXAMPLE
Triangle begins:
1;
1, 0;
1, 2, 0;
1, 0, 1, 0;
1, 2, 1, 0, 0;
1, 0, 2, 2, 0, 0;
1, 2, 1, 0, 1, 0, 0;
1, 0, 1, 4, 1, 0, 0, 0;
1, 2, 2, 0, 3, 2, 0, 0, 0;
1, 0, 1, 4, 2, 0, 1, 0, 0, 0;
1, 2, 1, 0, 3, 6, 1, 0, 0, 0, 0;
1, 0, 2, 4, 3, 0, 4, 2, 0, 0, 0, 0;
1, 2, 1, 0, 3, 8, 3, 0, 1, 0, 0, 0, 0;
1, 0, 1, 4, 3, 0, 6, 8, 1, 0, 0, 0, 0, 0;
1, 2, 2, 0, 4, 10, 5, 0, 5, 2, 0, 0, 0, 0, 0;
...
For n = 6 there are a total of 5 compositions:
k = 1: (6)
k = 3: (123), (321)
k = 4: (2121), (1212)
MAPLE
b:= proc(n, i) option remember; `if`(n<1 or i<1, 0,
`if`(n=i, x, add(expand(x*b(n-i, i+j)), j=[-1, 1])))
end:
T:= n-> (p-> seq(coeff(p, x, i), i=1..n))(add(b(n, j), j=1..n)):
seq(T(n), n=1..14); # Alois P. Heinz, Jul 22 2023
MATHEMATICA
b[n_, i_] := b[n, i] = If[n < 1 || i < 1, 0, If[n == i, x, Sum[Expand[x*b[n - i, i + j]], {j, {-1, 1}}]]];
T[n_] := CoefficientList[Sum[b[n, j], {j, 1, n}], x] // Rest // PadRight[#, n]&;
Table[T[n], {n, 1, 13}] // Flatten (* Jean-François Alcover, Sep 06 2023, after Alois P. Heinz *)
PROG
(PARI)
step(R, n)={matrix(n, n, i, j, if(i>j, if(j>1, R[i-j, j-1]) + if(j+1<=n, R[i-j, j+1])) )}
T(n)={my(v=vector(n), R=matid(n), m=0); while(R, m++; v[m]+=vecsum(R[n, ]); R=step(R, n)); v}
for(n=1, 15, print(T(n)))
CROSSREFS
Row sums are A173258.
T(2n,n) gives A364529.
Sequence in context: A116927 A137276 A287234 * A140581 A137277 A039975
KEYWORD
nonn,tabl
AUTHOR
Andrew Howroyd, Aug 23 2019
STATUS
approved

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 June 12 11:47 EDT 2024. Contains 373331 sequences. (Running on oeis4.)