login
T(n,k)=Number of length n+1 nonnegative integer arrays starting and ending with 0 with adjacent elements unequal but differing by no more than k
10

%I #17 Sep 24 2019 09:19:59

%S 0,0,1,0,2,0,0,3,2,2,0,4,6,11,0,0,5,12,35,24,5,0,6,20,82,138,93,0,0,7,

%T 30,160,454,689,272,14,0,8,42,277,1130,2912,3272,971,0,0,9,56,441,

%U 2370,8927,18652,16522,3194,42,0,10,72,660,4424,22297,71630,124299,83792,11293,0,0

%N T(n,k)=Number of length n+1 nonnegative integer arrays starting and ending with 0 with adjacent elements unequal but differing by no more than k

%C Table starts

%C ..0...0.....0......0......0.......0.......0........0........0........0

%C ..1...2.....3......4......5.......6.......7........8........9.......10

%C ..0...2.....6.....12.....20......30......42.......56.......72.......90

%C ..2..11....35.....82....160.....277.....441......660......942.....1295

%C ..0..24...138....454...1130....2370....4424.....7588....12204....18660

%C ..5..93...689...2912...8927...22297...48335....94456...170529...289229

%C ..0.272..3272..18652..71630..214724..542850..1211784..2459988..4633800

%C .14.971.16522.124299.594405.2133784.6285127.16018970.36557640.76469705

%H R. H. Hardin, <a href="/A205341/b205341.txt">Table of n, a(n) for n = 1..9999</a>

%F Empirical for row n:

%F n=2: T(2,k) = k

%F n=3: T(3,k) = k^2 - k

%F n=4: T(4,k) = (4/3)*k^3 - (1/2)*k^2 + (7/6)*k

%F n=5: T(5,k) = (23/12)*k^4 - (1/2)*k^3 + (1/12)*k^2 - (3/2)*k

%F n=6: T(6,k) = (44/15)*k^5 - (5/12)*k^4 + (5/12)*k^2 + (31/15)*k

%F n=7: T(7,k) = (841/180)*k^6 - (1/3)*k^5 - (19/36)*k^4 + (1/3)*k^3 - (103/90)*k^2 - 3*k

%F T(n,m) = 1/n*Sum_{i=1..n} (Sum_{,l,0,i} (binomial(i,l)*(-1)^l *Sum_{j=0..(i-l)* m/(2*m+1)}((-1)^j*binomial(i-l,j)*binomial((-l-2*j+i)*m-l-j+i-1,(-l-2*j+i)*m-j)))*T(n-i,m)), T(0,m)=1. - _Vladimir Kruchinin_, Apr 07 2017

%e Some solutions for n=5, k=3:

%e ..0....0....0....0....0....0....0....0....0....0....0....0....0....0....0....0

%e ..2....2....2....2....3....2....1....2....2....2....2....2....1....3....2....3

%e ..4....5....4....0....2....4....4....4....1....4....3....1....2....5....5....5

%e ..6....4....3....1....4....1....2....2....0....1....0....2....4....4....4....4

%e ..3....3....2....3....1....2....1....3....3....3....2....3....2....2....2....1

%e ..0....0....0....0....0....0....0....0....0....0....0....0....0....0....0....0

%t T[n_, m_] := T[n, m] = If[n == 0, 1, 1/(n)*Sum[Sum[Binomial[i, l]*(-1)^l* Sum[(-1)^j*Binomial[i-l, j]*Binomial[(-l - 2*j + i)*m - l - j + i - 1, (-l - 2*j + i)*m-j], {j, 0, (i-l)*m/(2*m+1)}], {l, 0, i}]*T[n-i, m], {i, 1, n}]];

%t Table[T[n-m+1, m], {n, 1, 11}, {m, n, 1, -1}] // Flatten (* _Jean-François Alcover_, Sep 24 2019, after _Vladimir Kruchinin_ *)

%o (Maxima)

%o T(n,m):=if n=0 then 1 else 1/(n)*sum(sum(binomial(i,l)*(-1)^l*sum((-1)^j*binomial(i-l,j)*binomial((-l-2*j+i)*m-l-j+i-1,(-l-2*j+i)*m-j),j,0,(i-l)*m/(2*m+1)),l,0,i)*T(n-i,m),i,1,n); /* _Vladimir Kruchinin_, Apr 07 2017 */

%Y Column 1 odd n is A000108((n+5)/2).

%Y Column 2 is A187430.

%Y Row 3 is A002378(n-1).

%K nonn,tabl,look

%O 1,5

%A _R. H. Hardin_, Jan 26 2012