A283654 Triangle T(n,m) read by rows: number of n X m binary matrices with no rows or columns in which all entries are the same (n >= 1, 1 <= m <= n).
0, 0, 2, 0, 6, 102, 0, 14, 906, 22874, 0, 30, 6510, 417810, 17633670, 0, 62, 42666, 6644714, 622433730, 46959933962, 0, 126, 267582, 99044946, 20218802310, 3204360965106, 451575174961302, 0, 254, 1641786, 1430529674, 630917888610, 208308918928634, 60134626974122946, 16271255119687320314
Offset: 1
Examples
The T(2,3)=6 matrices are 1 0 1 0 1 0 and the matrices obtained by permutations of rows and columns. First values in triangle 0; 0, 2; 0, 6, 102; 0, 14, 906, 22874; 0, 30, 6510, 417810, 17633670; 0, 62, 42666, 6644714, 622433730, 46959933962; 0, 126, 267582, 99044946, 20218802310, 3204360965106, 451575174961302;
Programs
-
Maple
T0:=(n,m)->add((-1)^(m+k)*binomial(n,k)*(2^k-1)^m, k=0..n): T:=(n,m)->2*T0(n,m)+2^(n*m)+(2^n-2)^m+(2^m-2)^n-2*(2^m-1)^n-2*(2^n-1)^m: seq(seq(T(n,m), m=1..n),n=1..10);
-
Mathematica
T[n_, m_] := Sum[(-1)^j*Binomial[m, j]*(2^(m - j) - 1)^n, {j, 0, m}]; Flatten[Table[2*T[n, m] + 2^(n*m) + (2^n - 2)^m + (2^m - 2)^n - 2*(2^m - 1)^n - 2*(2^n - 1)^m, {n, 10}, {m, n}]] (* Indranil Ghosh, Mar 14 2017 *)
-
PARI
T(n, m) = sum(j=0, m, (-1)^j*binomial(m, j)*(2^(m - j) - 1)^n); tabl(nn) = {for(n=1, nn, for(m=1, n, print1(2*T(n,m) + 2^(n*m) + (2^n - 2)^m + (2^m - 2)^n - 2*(2^m - 1)^n - 2*(2^n - 1)^m,", ");); print(););}; tabl(10); \\ Indranil Ghosh, Mar 14 2017
-
Python
import math f=math.factorial def C(n,r): return f(n)//f(r)//f(n - r) def T(n,m): return sum([(-1)**j*C(m,j)*(2**(m - j) - 1)**n for j in range (0, m+1)]) i=1 for n in range(1,11): for m in range(1, n+1): print(str(i)+" "+str(2*T(n, m) + 2**(n*m) + (2**n - 2)**m + (2**m - 2)**n - 2*(2**m - 1)**n - 2*(2**n - 1)**m)) i+=1 # Indranil Ghosh, Mar 14 2017
Formula
T(n,m) = T(m,n) = 2*A183109(n,m) + 2^(n*m) + (2^n-2)^m + (2^m-2)^n - 2*(2^m-1)^n - 2*(2^n-1)^m.
T(n,1)=0, T(n,2)=2^n-2, T(n,3)=6^n-6*(3^n-2^n).