/* We start by setting up Suz(512) and Suz(8), and then compute which elements of order 37 from E8 have
   eigenvalues compatible with coming from a copy of Suz(512). The program determines this depending on
   whether there are no, is one, or are two 64-dimensional composition factors of the action on L(E8).
   This yields a set Soln, which is the collection of possible eigenvalues. */

//A few short programs that are needed to work inside groups of Lie type.

function AddArrays(X)
return [&+[i[j]:i in X]:j in [1..#X[1]]];
end function;

function AllSequences(X)

if(#X eq 1) then return [[i]:i in X[1]]; end if;
A:=AllSequences(Prune(X));
return [Append(i,j):i in A,j in X[#X]];
end function;

function ExpressElementInGenerators(G,x)
d:=#Generators(G);
ords:=[Order(G.i):i in [1..d]];
AbIm:=AbelianGroup(ords);
phi:=Isomorphism(G,AbIm,[G.i:i in [1..d]],[AbIm.i:i in [1..d]]);
return ElementToSequence(x@phi);
end function;

function ConstructPreimages(El,n,m)
Powers:=[];
for i in El do Append(~Powers,[j:j in [0..n-1] | (m*j mod n) eq i]); end for;
return AllSequences(Powers);
end function;

function ProduceGroupElements(G,Seqs)

return [&*[G.i^j[i]:i in [1..#Generators(G)]]:j in Seqs];
end function;

function ProduceGroupElement(G,Seq)

return &*[G.i^Seq[i]:i in [1..#Generators(G)]];
end function;

/*This function takes a set X, consisting of a set N of integers, and a permutation g in Sym(N), and returns the set of
representatives of orbits of elements of X under the action of g.
*/

function EigsToMultiset(E)
return {*i[1]^^i[2]:i in E*};
end function;

// Set up the Suzuki group, the simple modules, the elements that we need, and their eigenvalues on L(E8)

G2:=SuzukiGroup(512);
_:=RecognizeSz(G2);

repeat x:=Random(G2); until Order(x) eq 481;
y:=x^37;
x:=x^13;
FF<vv>:=GF(512^4);
v481:=vv^(Order(vv) div 481);
v37:=v481^13;
v13:=v481^37;
v7:=vv^(Order(vv) div 7);
//ww:=vv^(Order(vv) div 4095);
X1:=CyclicGroup(37);
X2:=CyclicGroup(13);
X3:=CyclicGroup(7);
X4:=CyclicGroup(481);

/* We now find a copy of Sz(8) inside Sz(512), and then conjugate it so that the element y of order 13
   in G2 lies in the Sz(8) as well. That way we don't have to worry about messy conjugacy issues. */

ZG2:=SuzukiMaximalSubgroups(G2);
for i in ZG2 do if(Order(i) eq 29120) then H2:=i; break i; end if; end for;
Y2:=Sylow(H2,13);
Y:=sub<G2|y>;
gg:=SuzukiSylowConjugacy(G2,Y2,Y,13);
H2:=H2^gg;
z:=Sylow(H2,7).1;

// Fix certain powers of x, y and z so that we always obtain the same eigenvalues

for i in [1..36] do
  if(v37 in {j[1]:j in Eigenvalues(ChangeRing(x^i,FF))}) then x:=x^i; break i; end if;
end for;

for i in [1..12] do
  if(v13 in {j[1]:j in Eigenvalues(ChangeRing(y^i,FF))}) then y:=y^i; break i; end if;
end for;

for i in [1,5,8,12] do
  if(v481^24 in {j[1]:j in Eigenvalues(ChangeRing(x*y^i,FF))}) then y:=y^i; break i; end if;
end for;

for i in [1,2,3] do if({j[1]:j in Eigenvalues(ChangeRing(z^i,FF))} eq {v7,v7^2,v7^5,v7^6}) then z:=z^i; break i; end if; end for;

// G2:=sub<G2|G2.1,G2.2,G2.3,x,y,z>;

// Here are the simple modules for G2

S1:=TrivialModule(G2,GF(512));
S41:=GModule(G2);
S42:=GModule(G2,FrobeniusImage(S41,1));
S43:=GModule(G2,FrobeniusImage(S41,2));
S44:=GModule(G2,FrobeniusImage(S41,3));
S45:=GModule(G2,FrobeniusImage(S41,4));
S46:=GModule(G2,FrobeniusImage(S41,5));
S47:=GModule(G2,FrobeniusImage(S41,6));
S48:=GModule(G2,FrobeniusImage(S41,7));
S49:=GModule(G2,FrobeniusImage(S41,8));

S1612:=TensorProduct(S41,S42); S1613:=TensorProduct(S41,S43); S1614:=TensorProduct(S41,S44);
S1615:=TensorProduct(S41,S45); S1616:=TensorProduct(S41,S46); S1617:=TensorProduct(S41,S47);
S1618:=TensorProduct(S41,S48); S1619:=TensorProduct(S41,S49); S1623:=TensorProduct(S42,S43);
S1624:=TensorProduct(S42,S44); S1625:=TensorProduct(S42,S45); S1626:=TensorProduct(S42,S46);
S1627:=TensorProduct(S42,S47); S1628:=TensorProduct(S42,S48); S1629:=TensorProduct(S42,S49);
S1634:=TensorProduct(S43,S44); S1635:=TensorProduct(S43,S45); S1636:=TensorProduct(S43,S46);
S1637:=TensorProduct(S43,S47); S1638:=TensorProduct(S43,S48); S1639:=TensorProduct(S43,S49);
S1645:=TensorProduct(S44,S45); S1646:=TensorProduct(S44,S46); S1647:=TensorProduct(S44,S47);
S1648:=TensorProduct(S44,S48); S1649:=TensorProduct(S44,S49); S1656:=TensorProduct(S45,S46);
S1657:=TensorProduct(S45,S47); S1658:=TensorProduct(S45,S48); S1659:=TensorProduct(S45,S49);
S1667:=TensorProduct(S46,S47); S1668:=TensorProduct(S46,S48); S1669:=TensorProduct(S46,S49);
S1678:=TensorProduct(S47,S48); S1679:=TensorProduct(S47,S49); S1689:=TensorProduct(S48,S49);

Irr:=[S1,S41,S42,S43,S44,S45,S46,S47,S48,S49,S1612,S1613,S1614,S1615,S1616,S1617,S1618,S1619,
S1623,S1624,S1625,S1626,S1627,S1628,S1629,S1634,S1635,S1636,S1637,S1638,S1639,S1645,
S1646,S1647,S1648,S1649,S1656,S1657,S1658,S1659,S1667,S1668,S1669,S1678,S1679,S1689];

for i in [2..8] do for j in [i+1..9] do for k in [j+1..10] do Append(~Irr,TensorProduct(TensorProduct(Irr[i],Irr[j]),Irr[k])); end for; end for; end for;

/* In order to avoid using 35GB of memory by specifying x,y,z as generators of the group,
   we construct the restrictions of Irr to the cyclic subgroups directly, as modules for
   the group Xi. */

// Here are the modules for the subgroup <x>.

S1a:=TrivialModule(X1,GF(512));
S41a:=GModule(X1,[x]);
IrrX1:=[S1a,S41a];
for i in [1..8] do Append(~IrrX1,GModule(X1,FrobeniusImage(IrrX1[2],i))); end for;
for i in [2..9] do for j in [i+1..10] do Append(~IrrX1,TensorProduct(IrrX1[i],IrrX1[j])); end for; end for;
for i in [2..8] do for j in [i+1..9] do for k in [j+1..10] do Append(~IrrX1,TensorProduct(TensorProduct(IrrX1[i],IrrX1[j]),IrrX1[k])); end for; end for; end for;

// Here are the modules for the subgroup <y>.

S1b:=TrivialModule(X2,GF(512));
S41b:=GModule(X2,[y]);
IrrX2:=[S1b,S41b];
for i in [1..8] do Append(~IrrX2,GModule(X2,FrobeniusImage(IrrX2[2],i))); end for;
for i in [2..9] do for j in [i+1..10] do Append(~IrrX2,TensorProduct(IrrX2[i],IrrX2[j])); end for; end for;
for i in [2..8] do for j in [i+1..9] do for k in [j+1..10] do Append(~IrrX2,TensorProduct(TensorProduct(IrrX2[i],IrrX2[j]),IrrX2[k])); end for; end for; end for;

// Here are the modules for the subgroup <z>.

S1c:=TrivialModule(X3,GF(512));
S41c:=GModule(X3,[z]);
IrrX3:=[S1c,S41c];
for i in [1..8] do Append(~IrrX3,GModule(X3,FrobeniusImage(IrrX3[2],i))); end for;
for i in [2..9] do for j in [i+1..10] do Append(~IrrX3,TensorProduct(IrrX3[i],IrrX3[j])); end for; end for;
for i in [2..8] do for j in [i+1..9] do for k in [j+1..10] do Append(~IrrX3,TensorProduct(TensorProduct(IrrX3[i],IrrX3[j]),IrrX3[k])); end for; end for; end for;

// Here are the modules for the subgroup <x*y>.

S1d:=TrivialModule(X4,GF(512));
S41d:=GModule(X4,[x*y]);
IrrX4:=[S1d,S41d];
for i in [1..8] do Append(~IrrX4,GModule(X4,FrobeniusImage(IrrX4[2],i))); end for;
for i in [2..9] do for j in [i+1..10] do Append(~IrrX4,TensorProduct(IrrX4[i],IrrX4[j])); end for; end for;
for i in [2..8] do for j in [i+1..9] do for k in [j+1..10] do Append(~IrrX4,TensorProduct(TensorProduct(IrrX4[i],IrrX4[j]),IrrX4[k])); end for; end for; end for;

// Now the simple modules for H2

T1:=TrivialModule(H2,GF(512));
T41:=GModule(H2);
T42:=GModule(H2,FrobeniusImage(T41,1));
T43:=GModule(H2,FrobeniusImage(T41,2));
T1612:=TensorProduct(T41,T42); T1613:=TensorProduct(T41,T43); T1623:=TensorProduct(T42,T43);
T64:=TensorProduct(T43,T1612);

IrrH:=[T1,T41,T42,T43,T1612,T1613,T1623,T64];

// We compute the conspicuous sets of composition factors for H2 first, to obtain the traces of y and z.

/* You can run this if you want to, or just accept the answer below.
CCH2:=ConjugacyClasses(H2);
load "Subgroups/ComputeFactors.txt";
AnsA:=RestrictedPartitions(248,{1,4,16,64});
AnsB:=[i:i in AnsA|Multiplicity(i,1) ge 8];
AnsC:=[i:i in AnsB|&+[Multiplicity(i,j):j in [1,16]]-&+[Multiplicity(i,j):j in [4,64]] in {-2,23}];
Ans3,Mods3:=ComputeConspicuousFactorsE8LowMemory(IrrH,CCH2,Tr,[13,7,5],AnsC);
*/
Ans3:=[
    {* 1^^68, 2^^32, 3, 4^^12 *},
    {* 1^^68, 2^^12, 3^^32, 4 *},
    {* 1^^68, 2, 3^^12, 4^^32 *},
    {* 1^^32, 2^^16, 3^^16, 4^^6, 5^^4 *},
    {* 1^^32, 2^^16, 3^^6, 4^^16, 6^^4 *},
    {* 1^^32, 2^^9, 3^^8, 4, 5, 7^^8 *},
    {* 1^^32, 2^^8, 3, 4^^9, 5^^8, 6 *},
    {* 1^^32, 2^^6, 3^^16, 4^^16, 7^^4 *},
    {* 1^^32, 2, 3^^9, 4^^8, 6^^8, 7 *},
    {* 1^^24, 2^^12, 3^^12, 4^^8, 5^^3, 7^^3 *},
    {* 1^^24, 2^^12, 3^^11, 4^^9, 5^^4, 7^^2 *},
    {* 1^^24, 2^^12, 3^^8, 4^^12, 5^^3, 6^^3 *},
    {* 1^^24, 2^^11, 3^^9, 4^^12, 5^^2, 6^^4 *},
    {* 1^^24, 2^^9, 3^^12, 4^^11, 6^^2, 7^^4 *},
    {* 1^^24, 2^^8, 3^^12, 4^^12, 6^^3, 7^^3 *},
    {* 1^^16, 2^^8, 3^^7, 4^^7, 5^^2, 6, 7^^2, 8 *},
    {* 1^^16, 2^^7, 3^^8, 4^^7, 5, 6^^2, 7^^2, 8 *},
    {* 1^^16, 2^^7, 3^^7, 4^^8, 5^^2, 6^^2, 7, 8 *},
    {* 1^^12, 2^^5, 3^^5, 4^^5, 5, 6, 7, 8^^2 *}
];
Mods3:=[DirectSum([IrrH[i]:i in j]):j in Ans3];

load "Subgroups/functions.txt";

// Compute the dimensions of the eigenspaces of x,y,z and x*y on each simple modules

ModEigs37:=[EigsToMultiset(EigenvaluesOfElement(ChangeRing(M,FF),X1.1)):M in IrrX1];
EigsCoeffs37:=[[Multiplicity(i,v37^j):j in [0..18]]:i in ModEigs37];

ModEigs13:=[EigsToMultiset(EigenvaluesOfElement(ChangeRing(M,FF),X2.1)):M in IrrX2];
EigsCoeffs13:=[[Multiplicity(i,v13^j):j in [0..6]]:i in ModEigs13];

ModEigs7:=[EigsToMultiset(EigenvaluesOfElement(ChangeRing(M,FF),X3.1)):M in IrrX3];
EigsCoeffs7:=[[Multiplicity(i,v7^j):j in [0..3]]:i in ModEigs7];

ModEigs481:=[EigsToMultiset(EigenvaluesOfElement(ChangeRing(M,FF),X4.1)):M in IrrX4];
EigsCoeffs481:=[[Multiplicity(i,v481^j):j in [0..240]]:i in ModEigs481];


/* This code computes the elements of order 37 that are consistent with a conspicuous
   set of composition factors, at least for elements of orders 5 and 37, with the set
   of cfs having a given collection of 64s. */

load "Traces/E8/Tr37E8Eigs";
Tr37:=SetToSequence(Tr37E8Eigs);
Mat37R:=Matrix(Rationals(),[EigsCoeffs37[i]:i in [1..46]]);
permeigs:=Sym(37)!(2,3,5,9,17,33,28,18,35,32,26,14,27,16,31,24,10,19,37,36,34,30,22,6,11,21,4,7,13,25,12,23,8,15,29,20);


/* This function checks that the element of order 37 has eigenspaces that are
   consistent, where ToRem is a sequence of integers, say [47,48], and this means
   that we require Irr[47]+Irr[48] to be in the potential set of composition
   factors. This outputs a sequence Soln of the dimensions of the eigenspaces of
   the possible elements of order 37. */
   
function ComputeSolutions(ToRem)
Soln:=[];
  for ii in [1..#Tr37] do
    Ans1:=[Multiplicity(Tr37[ii],w37^i):i in [0..18]];
    Ans2:=SubtractArrays(Ans1,AddArrays([EigsCoeffs37[i]:i in ToRem]));
    if(Minimum(Ans2) lt 0 or Ans2[1] lt 8) then continue ii; end if;
    try ss:=Solution(Mat37R,Matrix(Rationals(),[Ans2])); Append(~Soln,Ans1 cat Prune(Reverse(Ans1))); catch e; end try;
  end for;
if(ToRem ne []) then return Sort(Soln); end if;

// If ToRem=[] then we can work up to automorphism, in which case we can apply this code
Sort(~Soln);
OrbReps:=[];
Found:={};
for i in [1..#Soln] do if(i in Found) then continue i; end if;
  Append(~OrbReps,i); Include(~Found,i);
  for j in [1..36] do
    neworb:=[Soln[i,1]]; for ii in [2..37] do Append(~neworb,Soln[i,ii^(permeigs^j)]); end for;
    Include(~Found,Position(Soln,neworb));
  end for;
end for;
delete Found;
return [Soln[i]:i in OrbReps];
end function;

/* If ToRem is [], then we obtain this set of eigenspaces.
[[8,6,7,7,7,7,6,7,6,7,6,6,7,7,6,7,7,7,7,7,7,7,7,6,7,7,6,6,7,6,7,6,7,7,7,7,6],
[12,3,9,6,5,10,3,10,5,7,7,5,9,5,7,7,7,7,6,6,7,7,7,7,5,9,5,7,7,5,10,3,10,5,6,9,3],
[12,4,6,7,8,7,4,7,9,7,4,9,6,8,4,7,7,7,7,7,7,7,7,4,8,6,9,4,7,9,7,4,7,8,7,6,4],
[12,4,7,7,6,8,4,8,8,6,6,8,7,6,6,7,7,6,7,7,6,7,7,6,6,7,8,6,6,8,8,4,8,6,7,7,4],
[12,5,7,6,6,8,5,8,6,7,6,6,7,6,6,8,8,7,6,6,7,8,8,6,6,7,6,6,7,6,8,5,8,6,6,7,5],
[12,6,6,6,6,7,6,7,6,7,8,6,6,6,8,7,7,7,6,6,7,7,7,8,6,6,6,8,7,6,7,6,7,6,6,6,6],
[16,2,8,5,6,10,2,10,6,8,5,6,8,6,5,8,8,8,5,5,8,8,8,5,6,8,6,5,8,6,10,2,10,6,5,8,2],
[16,2,8,6,4,12,2,12,4,7,9,4,8,4,9,6,6,7,6,6,7,6,6,9,4,8,4,9,7,4,12,2,12,4,6,8,2],
[16,3,8,8,4,10,3,10,6,4,7,6,8,4,7,8,8,4,8,8,4,8,8,7,4,8,6,7,4,6,10,3,10,4,8,8,3],
[20,0,6,9,5,12,0,12,6,4,9,6,6,5,9,6,6,4,9,9,4,6,6,9,5,6,6,9,4,6,12,0,12,5,9,6,0],
[20,0,12,6,3,13,0,13,4,9,6,4,12,3,6,4,4,9,6,6,9,4,4,6,3,12,4,6,9,4,13,0,13,3,6,12,0],
[20,1,6,3,13,9,1,9,6,12,1,6,6,13,1,6,6,12,3,3,12,6,6,1,13,6,6,1,12,6,9,1,9,13,3,6,1],
[20,3,6,4,4,12,3,12,3,9,10,3,6,4,10,6,6,9,4,4,9,6,6,10,4,6,3,10,9,3,12,3,12,4,4,6,3],
[20,4,6,9,9,9,4,9,4,6,4,4,6,9,4,6,6,6,9,9,6,6,6,4,9,6,4,4,6,4,9,4,9,9,9,6,4],
[24,0,2,3,18,6,0,6,9,12,0,9,2,18,0,6,6,12,3,3,12,6,6,0,18,2,9,0,12,9,6,0,6,18,3,2,0],
[32,0,0,0,24,4,0,4,6,16,0,6,0,24,0,4,4,16,0,0,16,4,4,0,24,0,6,0,16,6,4,0,4,24,0,0,0],
[32,0,10,8,1,16,0,16,1,8,9,1,10,1,9,1,1,8,8,8,8,1,1,9,1,10,1,9,8,1,16,0,16,1,8,10,0],
[32,1,9,8,8,8,1,8,1,9,1,1,9,8,1,9,9,9,8,8,9,9,9,1,8,9,1,1,9,1,8,1,8,8,8,9,1],
[68,0,0,0,12,0,0,0,0,1,32,0,0,12,32,0,0,1,0,0,1,0,0,32,12,0,0,32,1,0,0,0,0,12,0,0,0]];


// We now want to use the possible Sz(8)s to work out conspicuous sets of composition factors for elements of order at most 37.

Mat37:=Matrix(Integers(),[EigsCoeffs37[i]:i in [1..46]]);
Mat13:=Matrix(Integers(),[EigsCoeffs13[i]:i in [1..46]]);
Mat7:=Matrix(Integers(),[EigsCoeffs7[i]:i in [1..46]]);
MatBoth:=HorizontalJoin(Mat37,Mat13);
MatAll:=HorizontalJoin(MatBoth,Mat7);

// These are the eigenvalues for the 32 conspicuous sets of composition factors for Sz(8), for elements of orders 13 and 7.

EigsSz813:=[EigsToMultiset(EigenvaluesOfElement(ChangeRing(i,FF),y)):i in Mods3];
EigsSz8Coeffs13:=[[Multiplicity(i,v13^j):j in [0..6]]:i in EigsSz813];
EigsSz87:=[EigsToMultiset(EigenvaluesOfElement(ChangeRing(i,FF),z)):i in Mods3];
EigsSz8Coeffs7:=[[Multiplicity(i,v7^j):j in [0..3]]:i in EigsSz87];
EigsSz8:=[EigsSz8Coeffs13[i] cat EigsSz8Coeffs7[i]:i in [1..#Mods3]];

// Which of the eigenvalues above are consistent with the element of order 37 in OrbitReps? All of them. Need something better
rel:=Matrix(Integers(),30,1,[0:i in [1..30]]);
obj:=Matrix(Integers(),1,46,[1:i in [1..46]]);

/* Given Soln, we want to compute which of the 19 conspicuous sets of composition
   factors for Suz(8) are compatible with a given element of order 37. The next
   function returns a sequence of sequences, ThingsThatWork, which gives this. Of
   course, just because the traces are consistent doesn't mean it can work: for
   example, set 19 can only work with two 64-dimensional modules for Suz(512) that
   restrict irreducibly to Suz(8). */

function FindThingsThatWork(Soln)
ThingsThatWork:=[[]:jj in [1..#Soln]];
for jj in [1..#Soln] do
  for ii in [1..#Mods3] do
    rhs:=Matrix(Integers(),30,1,[Soln[jj,jjj]:jjj in [1..19]] cat EigsSz8[ii]);
    a,b:=MaximalIntegerSolution(Transpose(MatAll),rel,rhs,obj); a,b;
    if(b eq 0) then Append(~ThingsThatWork[jj],ii); end if;
  end for;
end for;
return ThingsThatWork;
end function;

// We now show as an example what happens with ToRem eq [].

/* These are the possible Sz8eigs that are consistent with coming from a given member
   of Soln for ToRem=[]. For each of these we must construct first, all possible
   eigenvalues for an element of order 37*13 that restricts to 37 and 13 with these
   given eigenvalues, and then all possible sets of composition factors with these
   37s, 13s, 7s and 5s.*/

ThingsThatWork:=[[8,10,11,12,13,14,15,16,17,18,19],[8,9,10,11,12,13,14,15,16,17,18,19],
[6,7,8,9,10,11,12,13,14,15,16,17,18,19],[6,7,9,10,11,12,13,14,15,16,17,18,19],
[7,8,9,10,11,12,13,14,15,16,17,18,19],[6,7,9,10,11,12,13,14,15,16,17,18,19],
[8,9,14,15,16,17,18,19],[8,9,10,12,13,14,15,16,17,18,19],
[6,7,8,9,10,12,13,14,15,16,17,18,19],[15,16,17,18,19],[8,9,15,19],[8],
[8,9,10,12,13,14,15,16,17,18,19],[14,15,17],[14,15],[8],[3,6,9],[9],[1]];

/* The different conspicuous sets of factors for Sz(8) can yield the same eigenvalues for
   y on L(E8). Thus there can be some amalgamation among these factors:
   (1), (2), (3), (4), (5), (6,7,9), (8), (10,11), (12,13), (14,15), (16,17,18,19).
   For no 64s, we may exclude (16,17,18,19), and also exclude (1),(2),(3) if we assume that
   an element of order 5 has trace -2. We thus just need to consider 4,5,6,8,10,12,14 when
   looking at an element of order 13*37. In addition, at least for no 64s, not checked in
   general, 6,7,9 only yields a module of negative pressure, so may exclude those as well. */

ThingsThatWork2:=[[8,10,12,14],[8,10,12,14],[8,10,12,14],[10,12,14],[8,10,12,14],[10,12,14],
[8,14],[8,10,12,14],[8,10,12,14],[15],[8,15],[8],[8,10,12,14],[14],[14],[8],[],[],[]];

/* Now for each pair [jj,ii], where jj runs between 1 and 19 and ii lies in ThingsThatWork2[jj],
   we want to multiply together a given element of order 37 with those eigenvalues by all
   elements of order 13 with the given eigenvalue. Because this code needs to be repeated 43
   times, we split it off into a separate file and then call it over and over again with slightly
   different parameters. We include in this file all of the basic information that we have
   computed here but without initializing Sz(512) at all. 

   We run many programs like the following:

screen -DR suzcase18
magma
jj:=1;
load "Subgroups/E8/Suz512/E8RepsOrder13Case8";
load "Subgroups/E8/Suz512/Suz512code.txt";

   Each one of these takes quite a long time to work, but we may utilize parallel processing to
   cut down the runtime massively. The code that Suz512NoneCode.txt has is as follows: it directly
   implements the various arrays produced in this document, in particular EigsOfMats below, and
   EigsCoeffs481, together with holding the representative elements of order 37 given below with
   the correct eigenvalues on L(E8). */




// Running all of the programs in Suz512AllCommands yields the following collection of examples, up to field automorphism.

SolnsNo64s:=[{*1^^16,3^^4,4^^4,7^^8,8^^9,9,23^^2,28^^2,41^^4*},{*1^^16,3^^4,5^^4,7^^8,8,9^^8,10,24^^2,33^^2,42^^4*},
{*1^^16,2,3^^4,6^^4,7^^8,8,10^^8,25^^2,37^^2,43^^4*},{*1^^24,4^^8,5^^9,9^^12,10^^3,26^^2,30^^4*},
{*1^^32,4^^16,5^^6,9^^16,30^^4*}];

EltsNo64s:=[[478,478,675,436,287,771,675,377],[427,675,248,712,590,422,200,287],[254,526,336,578,638,554,590,178],
[680,571,667,385,493,860,282,686],[295,102,391,475,577,385,571,0]];

SolnsOne64:=[{*1^^12,2^^4,3^^6,4,7^^4,8^^4,11^^2,16,22^^2,41,50*}];

EltsOne64:=[[308,529,364,699,550,699,502,747]];

SolnsTwo64s:=[{*1^^8,3^^2,4^^2,7^^4,8^^4,23,28,41^^2,50,51*},{*1^^8,2^^4,5^^2,7^^2,9^^4,13,17^^2,42,55,103*},{*1^^12,2^^4,3,5,7^^5,9^^4,15,17,42,55^^2*},
{*1^^12,3^^5,4,7^^4,8^^5,22,23,41,50^^2*},{*1^^12,3,4,5,7^^4,8^^4,9^^4,41,42,44,47^^2*},{*1^^8,2^^4,4^^2,7^^2,8^^4,12,16^^2,41,49,87*},
{*1^^12,2^^4,3,4,7^^5,8^^4,15,16,41,49^^2*},{*1^^12,3,4,5^^4,7^^4,8^^4,10,33,34,41,52^^2*},{*1^^12,3,4^^4,5,7^^4,9^^5,28,30,42,57^^2*},
{*1^^12,3^^5,5,7^^4,8,9^^4,22,24,42,56^^2*},{*1^^12,3,4^^4,6,7^^4,9,10^^4,28,31,43,62^^2*},{*1^^12,3,4^^5,7^^4,8^^4,9,28,29,41,51^^2*},
{*1^^12,3,4,6,7^^4,8^^4,10^^4,41,43,45,48^^2*}];

EltsTwo64s:=[[529,478,167,439,505,356,385,311],[721,161,512,506,193,762,751,187],[425,457,512,691,489,762,751,187],[758,161,475,506,193,799,714,224],
[462,457,475,691,489,799,714,224],[263,245,512,429,263,745,675,311],[356,409,627,529,484,215,263,747],[595,364,547,412,484,311,167,269],
[484,475,547,782,595,311,167,269],[595,771,547,412,558,311,574,269],[484,401,547,782,669,311,574,269],[669,364,473,412,484,385,574,269],
[558,475,473,782,595,385,574,269],[484,401,547,412,558,311,463,380],[558,475,473,412,484,385,463,380],[484,475,547,412,484,311,537,380],
[823,291,311,409,550,432,336,52],[601,550,52,409,550,654,595,52],[675,291,311,76,402,432,484,385],[453,550,52,76,402,654,743,385],
[263,747,530,311,388,453,509,287],[513,561,269,87,380,704,195,496],[475,667,747,391,475,338,274,640],[475,260,747,317,475,412,274,640],
[364,667,377,391,364,338,385,640],[475,556,747,502,364,338,385,640],[364,260,377,317,364,412,385,640],[475,630,747,428,364,412,385,640],
[401,667,747,391,475,412,200,714],[771,667,377,391,364,412,311,714],[401,556,747,502,364,412,311,714],[795,535,0,361,425,250,401,0],
[795,128,74,287,425,176,475,0],[388,128,407,361,425,176,475,0],[795,239,74,287,795,287,364,111],[388,239,407,361,795,287,364,111],
[795,165,0,361,795,361,771,111],[795,165,0,361,795,361,401,370],[795,239,74,287,795,287,475,370],[388,239,407,361,795,287,475,370],
[469,612,397,640,310,567,372,571],[358,723,397,640,310,567,372,571],[469,686,471,566,310,493,446,571],[358,797,471,566,310,493,446,571],
[395,612,471,640,310,493,372,645],[284,723,471,640,310,493,372,645],[469,723,397,640,680,678,261,682],[469,797,471,566,680,604,335,682],
[395,723,471,640,680,604,261,756],[675,550,311,409,550,654,484,311],[350,254,612,469,0,710,375,571],[350,254,612,395,74,710,375,571],
[350,254,612,469,407,784,375,571],[350,365,723,358,0,710,745,682],[239,365,612,469,0,710,745,682],[350,365,723,284,74,710,745,682],
[239,365,612,395,74,710,745,682],[350,365,723,358,407,784,745,682],[239,365,612,469,407,784,745,682]];

/* One may check the statement in the paper that most of these fit into a particular schema with the code:

ids:=[[1,2,3],[1,2,4],[1,2,5],[1,2,6],[1,2,7],[1,2,8],[1,3,5],[1,3,6],[1,3,7],[1,4,7]];

for ii in ids do
a:=ii[1]; b:=ii[2]; c:=ii[3];

ap4:=a+4; if(ap4 gt 9) then ap4-:=9; end if; ap4+:=1;
bp4:=b+4; if(bp4 gt 9) then bp4-:=9; end if; bp4+:=1;
cp4:=c+4; if(cp4 gt 9) then cp4-:=9; end if; cp4+:=1;

am4:=a-4; if(am4 lt 1) then am4+:=9; end if; am4+:=1;
bm4:=b-4; if(bm4 lt 1) then bm4+:=9; end if; bm4+:=1;
cm4:=c-4; if(cm4 lt 1) then cm4+:=9; end if; cm4+:=1;

a+:=1; b+:=1; c+:=1;

aa:={*1^^12,a^^4,b^^4,c^^4,am4,bm4,cm4*};
bb:={*TensorProduct(TensorProduct(Irr[ap4],Irr[bp4]),Irr[cp4])^^2,TensorProduct(Irr[a],Irr[b]),TensorProduct(Irr[c],Irr[b]),TensorProduct(Irr[a],Irr[c])*};
&or[{*j^(frob^i):j in SequenceToMultiset(IdentifyModules(bb,Irr)) join aa*} in SolnsTwo64s:i in [0..8]];
end for;

*/

AllElts:=EltsNo64s cat EltsOne64 cat EltsTwo64s;

// Not the same number of elements as each one may have multiple elements of order 481 that work.


/* Now we need to check that all of the elements above are blueprints. The code below does this, setting up
   a group of Lie type over GF(2887). */

q:=2887;
F:=GF(q);
u:=F!2;
u13:=u^111;
G:=GroupOfLieType("E8",q);
V:=VectorSpace(GF(q),8);
rho1:=StandardRepresentation(G);
Over1:=GL(248,q);
g1:=elt<G|V![u,1,1,1,1,1,1,1]>;
g2:=elt<G|V![1,u,1,1,1,1,1,1]>;
g3:=elt<G|V![1,1,u,1,1,1,1,1]>;
g4:=elt<G|V![1,1,1,u,1,1,1,1]>;
g5:=elt<G|V![1,1,1,1,u,1,1,1]>;
g6:=elt<G|V![1,1,1,1,1,u,1,1]>;
g7:=elt<G|V![1,1,1,1,1,1,u,1]>;
g8:=elt<G|V![1,1,1,1,1,1,1,u]>;
W:=Reflections(G);
Mats1:=[rho1(i):i in [g1,g2,g3,g4,g5,g6,g7,g8]];
MatsE:=[rho1(i):i in W];
NGT:=sub<Over1|Mats1 cat MatsE>;
T:=sub<NGT|Mats1>;
E:=sub<NGT|MatsE>;

T13:=sub<T|[T.i^111:i in [1..8]]>;
T37:=sub<T|[T.i^39:i in [1..8]]>;

EigsOfMats13:=[[(T13.i)[j,j]:j in [1..248]]:i in [1..8]];
EigsOfMats:=[[(T.i)[j,j]:j in [1..248]]:i in [1..8]];

for OneToCheck in [1..#AllElts] do
  El1:=AllElts[OneToCheck];
  nn:=#{&*[EigsOfMats481[j,i]^El1[j]:j in [1..8]]:i in [1..248]};
  "Looking for an element with",nn,"eigenvalues";
  Els1:=ConstructPreimages([(3*i) mod 1443:i in El1],1443,3);
  for El2 in Els1 do
    if(#{&*[EigsOfMats[j,i]^El2[j]:j in [1..8]]:i in [1..248]} eq nn and Order(ProduceGroupElement(T,El2)) eq 1443) then
      "Found an element of order 1443 with the correct eigenvalues in Case",OneToCheck;
      delete Els1; delete nn;
      continue OneToCheck;
    end if;
  end for;
  "DID NOT find an element of order 1443 with the correct eigenvalues in Case",OneToCheck;
  delete Els1; delete nn;
end for;

// Other random commands

function EigsToMultiset(E)
return {*i[1]^^i[2]:i in E*};
end function;

function NextEl(El,n)

if(El[1] lt n-1) then El[1]+:=1; return El; end if;
El[1]:=0;
El2:=NextEl(Remove(El,1),n);
return [0] cat El2;

end function;

