A383620 Number of weak compositions of n such that the set of adjacent differences is a subset of {-1,1}.
1, 4, 5, 9, 13, 20, 30, 45, 66, 102, 152, 229, 344, 518, 780, 1180, 1775, 2676, 4037, 6088, 9182, 13852, 20891, 31512, 47536, 71706, 108166, 163172, 246140, 371303, 560118, 844943, 1274606, 1922767, 2900522, 4375493, 6600511, 9956990, 15020307, 22658428
Offset: 0
Keywords
Examples
a(0) = 1: (0). a(1) = 4: (0,1), (0,1,0), (1,0), (1). ... a(4) = 13: (0,1,0,1,0,1,0,1), (0,1,0,1,0,1,0,1,0), (1,0,1,0,1,0,1,0), (1,0,1,0,1,0,1), (0,1,0,1,2), (1,0,1,2), (2,1,0,1,0), (2,1,0,1), (0,1,2,1,0), (0,1,2,1), (1,2,1,0), (1,2,1), (4).
Links
- Alois P. Heinz, Table of n, a(n) for n = 0..5598
Programs
-
PARI
M(k) = matrix(k+1,k+1, i,j, if(i==j,1,if(i==j-1, -x^(i-1), if(i==j+1, -x^(i-1), 0)))) A_x(N) = {my(k=N+1,x='x+O('x^k)); Vec(vecsum(M(k)^(-1) * vector(k+1,i,x^(i-1))~))} A_x(10)