//to get full number of disjoint bases for V_(n+1)(GF(2))

//enter n
"n=",n;
Dim:=Dimension;
Fn:=Floor(2^n/(n+1))-1;
V:=VectorSpace(GF(2),n+1);
VV:=[x:x in V| x[1] eq 1];
for l:=1 to 15 do
"attempt no.",l;
BA:=[];NA:=[];DA:=[];
VT:=VV;
for j:=1 to Fn+1 do
e:=Random({1..#VT});
ba:=[VT[e]];
na:={1};
for i:=1 to #VT do
if i ne e then
   flag:=true;
   c:=sub<V|ba,VT[i]>;
    if Dim(c) ne (#ba +1) then
    flag:=false;
    end if;
  if flag eq true then
  ba:=Append(ba,VT[i]);
  na:=na join {i};
  end if;
end if;
end for;
d:=Dim(sub<V|ba>);

BA:=Append(BA,ba);NA:=Append(NA,na);DA:=Append(DA,d);
if #Seqset(DA) gt 1 then
"FAILS at j=",j;
end if;

VT:=Setseq(Seqset(VT) diff Seqset(ba));

end for;

if #(Seqset(DA)) eq 1 then
"SUCCESS";
break l;
end if;
end for;
"no of matrices=",#BA;
"Fn+1=",Fn+1;
"dim row space",Seqset(DA),"n+1=",n+1;
 BAS:=[Seqset(BA[i]):i in [1..#BA]];
BASS:=&join[BAS[i]:i in [1..#BA]];
#BASS+#VT eq 2^n, "that all vectors are present";
