> restart:

 >

 > with(combinat):

 > with(linalg):

Warning, the protected name Chi has been redefined and unprotected

Warning, the previous binding of the name fibonacci has been removed and it now has an assigned value

Warning, the protected names norm and trace have been redefined and unprotected

 > n:=6:

 > k:=40:

 >

 > M:=matrix(k,k+n,0):

 > for i from 1 to k do

 > for j from 1 to k do

 > if i=j then M[i,j]:=1:fi:

 > od:od:

 > for i from 1 to k do M[i,k+1]:=1:od:

 > M[1,k+2]:=1:M[2,k+2]:=1:

 > print(M);

 > steps:=0:numtests:=0:flagvec:=vector(n,0):lastspot:=n+1:

 > for r from k to 2^n-1 do st:=time():

 > print(r);

 > for a from 2 to r do lastspot:=n+1:

 > for i from 1 to a do M[i,r+3]:=0:od:

 > for b1 from 0 to a do

 > for i from a+1 to r do M[i,r+3]:=0:od:

 > for b2 from a to r do

 >

 > checkb:=b1+b2-a:

 >

 > if b2

 > if b1+b2-a=r then next:fi:

 >

 > lastspot:=n+1:

 >

 > for c1 from 0 to b1 do

 > for i from b1+1 to a do M[i,r+4]:=0:od:

 > for c2 from b1 to a do

 > for i from a+1 to b2 do M[i,r+4]:=0:od:

 > for c3 from a to b2 do

 > for i from b2+1 to r do M[i,r+4]:=0:od:

 >

 > if a=2 and b1=0 and b2=5 and c1=0 and c2=0 and c3=2 then st:=11 else st:=b2:fi:

 > for c4 from st to r do print(time()-st,time()-mst,steps,numtests,a,b1,b2,c1,c2,c3);

 >

 > checkc:=c1+c2-b1+c3-a+c4-b2:

 > if c4

 >

 > if checkc=r then steps:=steps+1:next:fi:

 >

 > if lastspot<=3 then next:next:next:next:fi:

 >

 > lastspot:=n+1:

 >

 > for i from 1 to c1 do M[i,r+5]:=0:od:

 > for d1 from 0 to c1 do

 >

 > for i from c1+1 to b1 do M[i,r+5]:=0:od:

 > for d2 from c1 to b1 do

 > for i from b1+1 to c2 do M[i,r+5]:=0:od:

 > for d3 from b1 to c2 do

 > for i from c2+1 to a do M[i,r+5]:=0:od:

 > for d4 from c2 to a do

 > for i from a+1 to c3 do M[i,r+5]:=0:od:

 > for d5 from a to c3 do

 > for i from c3+1 to b2 do M[i,r+5]:=0:od:

 > for d6 from c3 to b2 do

 > for i from b2+1 to c4 do M[i,r+5]:=0:od:

 > for d7 from b2 to c4 do

 > for i from c4+1 to r do M[i,r+5]:=0:od:

 > for d8 from c4 to r do

 >

 >

 > checkd:=d1+d2-c1+d3-b1+d4-c2+d5-a+d6-c3+d7-b2+d8-c4:

 > if d8

 >

 >

 >

 > if checkd=r then next:fi:

 >

 >

 >

 > if lastspot<=4 then next:next:next:next:next:next:next:next:fi:

 > lastspot:=n+1:

 >

 > for i from 1 to d1 do M[i,r+6]:=0:od:for e1 from 0 to d1 do

 > for i from d1+1 to c1 do M[i,r+6]:=0:od:for e2 from d1 to c1 do

 > for i from c1+1 to d2 do M[i,r+6]:=0:od:for e3 from c1 to d2 do

 > for i from d2+1 to b1 do M[i,r+6]:=0:od:for e4 from d2 to b1 do

 > for i from b1+1 to d3 do M[i,r+6]:=0:od:for e5 from b1 to d3 do

 > for i from d3+1 to c2 do M[i,r+6]:=0:od:for e6 from d3 to c2 do

 > for i from c2+1 to d4 do M[i,r+6]:=0:od:for e7 from c2 to d4 do

 > for i from d4+1 to a do M[i,r+6]:=0:od:for e8 from d4 to a do

 >

 > for i from a+1 to d5 do M[i,r+6]:=0:od:for e9 from a to d5 do

 > for i from d5+1 to c3 do M[i,r+6]:=0:od:for e10 from d5 to c3 do

 > for i from c3+1 to d6 do M[i,r+6]:=0:od:for e11 from c3 to d6 do

 > for i from d6+1 to b2 do M[i,r+6]:=0:od:for e12 from d6 to b2 do

 > for i from b2+1 to d7 do M[i,r+6]:=0:od:for e13 from b2 to d7 do

 > for i from d7+1 to c4 do M[i,r+6]:=0:od:for e14 from d7 to c4 do

 > for i from c4+1 to d8 do M[i,r+6]:=0:od:for e15 from c4 to d8 do

 > for i from d8+1 to r do M[i,r+6]:=0:od:for e16 from d8 to r do

 >

 > steps:=steps+1:

 > checke:=e1+e2-d1+e3-c1+e4-d2+e5-b1+e6-d3+e7-c2+e8-d4+e9-a+e10-d5+e11-c3+e12-d6+e13-b2+e14-d7+e15-c4+e16-d8:

 > if e16

 >

 > if checke=r then next:fi:

 >

 > if lastspot<=n-1 then next:next:next:next:next:next:next:next:next:next:next:next:next:next:next:next:fi:

 >

 >

 > matroid(r,n,M);

 >

 > if e16

 > if e15

 > if e14

 > if e13

 > if e12

 > if e11

 > if e10

 > if e9

 > if e8

 > if e7

 > if e6

 > if e5

 > if e4

 > if e3

 > if e2

 > if e1

 >

 >

 > if d8

 > if d7

 > if d6

 > if d5

 > if d4

 > if d3

 > if d2

 > if d1

 >

 > if c4

 > if c3

 > if c2

 > if c1

 >

 > if b2

 > if b1

 >

 > if a

 >

 >

 >

 >

 >

 >

Grow M: (above)

 > N1:=delcols(M,r+1..r+n):N2:=vector(r+1,1):N3:=matrix(r+1,n-1,0):

 > N1:=extend(N1,1,1,0):

 > N1[r+1,r+1]:=1:

 > M:=concat(N1,N2,N3):print(r,time()-st);

 > od:

Warning, computation interrupted

 > print(d1,d2,d3,d4,d5,d6,d7,d8);

 > print(steps,a,b1,b2,c1,c2,c3,c4,d1,d2,d3,d4,d5,d6,d7,d8);

 > print(e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16);

 >

 > print(numtests);

 > print(M);

 >

 >

 >

 > global mst,numtests,flagmat,lastspot:numtests:=numtests+1:#flagvec:=vector(n,0):

 > mst:=time():flagmat:=matrix(n,r-1,0):

 > ind:=0:S:={}:A:={}:dup:={}:AA:=vector(2^n,0):

 > #for i from 1 to r+1 do dup:=dup union{col(M,i)}:od:

 >

 > for i from 1 to n do

 > v[i]:=col(M,r+i):#if v[i] in dup or v[i] in S or v[i]=vector(r,0) then return:fi:

 > S:=S union {v[i]}:

 > od:

 >

 > test:=vector(r-1,0):

 >

testing and measuring subsets

 >

 >

 > for j from 1 to n do

 > ind:=ind+1:if ind >= r then return: fi:test[ind]:=dotprod(v[1],v[j])+1:flagmat[j,ind]:=1:

 > if test[ind] in A then flagvec[j]:=1:return:fi:

 > A:=A union {test[ind]}:

 > if 1 in A or 2 in A then return:fi:

 > od:

 >

 > for i from 2 to n do

 >

 > T[i]:=convert(choose(S,i),list):#print(T[i]);

 >

 > for j from 1 to binomial(n,i) do

 >

 >

I need to now analyze each subset for compatibility.  j becomes the leading index.

 > dun:={}:

 > for k from 1 to floor(i/2) do

 >

 > V[i,j,k]:=convert(choose(T[i][j],k),list):

 >

Vijk is the list of k element subsets of Tij.  I need to compare each of these to its complement in Tij.

 > for l from 1 to binomial(i,k) do

 > W[i,j,k,l]:=convert(T[i][j] minus V[i,j,k][l],list):

 > V[i,j,k,l]:=convert(V[i,j,k][l],list):

 >

Wijk is the set of complements of the Vijk in Tij.

 > if V[i,j,k,l] in dun or W[i,j,k,l] in dun then next:next:next:fi:

 > dun:=dun union {V[i,j,k,l],W[i,j,k,l]}:

 >

 > sum1:=vector(r,0):sum2:=vector(r,0):

 > for m from 1 to k do

 > od:

 >

 > for m from 1 to i-k do

 > od:

 >

 >

 >

This tests for incompatible subsets.

 > for z from 1 to r do sum1[z]:=irem(sum1[z],2): sum2[z]:=irem(sum2[z],2): od:

 > for z from 1 to r do modsum[z]:=irem(modsum[z],2):od:

 > fi:

 >

 > od:

 > od:

 >

 >

 > for m from 1 to i do

 > od:

 > for z from 1 to r do

 > total[z]:=irem(total[z],2):

 > od:

 > ind:=ind+1:if ind=r then return;fi;#print(r, `is too low a rank`); return;fi;

 > test[ind]:=dotprod(v[1],total)+i:#T[i][j]:

 >

 >

 >

 > for floop from 1 to n do

 > if v[floop] in T[i][j] then flagmat[floop,ind]:=1:fi:od:

 >

 >

 > if test[ind] in A then

 > for findind from 1 to ind-1 do

 > if test[findind]=test[ind] then prob1:=col(flagmat,findind):prob2:=col(flagmat,ind):fi:

 > od:

 > for floop from 1 to n do

 > if prob1[floop]=1 or prob2[floop]=1 then lastspot:=floop:fi:

 > od:

 >

 > #print(T[i][j],lastspot,flagmat,test,prob1,prob2,M);

 >

 > return:fi:

 >

 >

 > if 1 in A or 2 in A then return:fi:

 > A:=A union {test[ind]}:#flagvec[ind]:=test[ind]:

 > fi:

 >

 >

 > od:od:if test[r-1]=0 then return;fi;#print(r, `is too high a rank`); return;fi;

 >

 >

 > print(r,test,M);

 > end proc:

Warning, `flagvec` is implicitly declared local to procedure `matroid`

 >

 >

 > matroid(24,5,B);

 > print(lastspot);

 >