
// Make newform 162.2.g.a in Magma, downloaded from the LMFDB on 16 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_162_g();"
// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_162_2_g_a();".
// This may take a long time!  To see verbose output, uncomment the SetVerbose line below.
// The default sign is -1.  You can change this with the optional parameter "sign".
// To make the character of type GrpDrchElt, type "MakeCharacter_162_g();"
function MakeCharacter_162_g()
    N := 162;
    order := 27;
    char_gens := [83];
    v := [8];
    // chi(gens[i]) = zeta^v[i]
    assert UnitGenerators(DirichletGroup(N)) eq char_gens;
    F := CyclotomicField(order);
    chi := DirichletCharacterFromValuesOnUnitGenerators(DirichletGroup(N,F),[F|F.1^e:e in v]);
    return MinimalBaseRingCharacter(chi);
end function;

function MakeCharacter_162_g_Hecke(Kf)
    return MakeCharacter_162_g();
end function;


// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_162_2_g_a();".
// This may take a long time!  To see verbose output, uncomment the SetVerbose line below.
// The default sign is -1.  You can change this with the optional parameter "sign".
function MakeNewformModSym_162_2_g_a( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_162_g();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,2,sign)));
    Vf := Kernel([<5,R![18487617876729, -66147312707901, -389971588969998, 3688005678595245, 10127863003144230, -290430059885208153, 2267928686904543558, -11532910190384285685, 44666277754795016310, -140285851606303122906, 368965030392689707467, -828023739147020669247, 1604464840435653552096, -2705627004610328540370, 3991501493254318790646, -5167416707914294899864, 5875539270631456499181, -5856353743839819509223, 5088374232110604417438, -3814103238214452766110, 2427764360206977100917, -1288311062821892716905, 569309201504709561495, -231268077709656221565, 115625899655006466420, -74593280088369757107, 40571736481071911025, -10420330097426565231, -4663589135885765496, 6255477436882040226, -3601549879720853121, 1933981561488652299, -1185978512570037255, 492967832749720641, -10212170436737325, -74262523173191829, 6981933423245760, 3965564709755163, 13845318444103977, -9860481858124341, 1025799001647687, -446934749947029, 1050026413177494, -333608013865935, 45477480112560, -72899173687680, 18719689234824, 8896529258631, -293997362913, -1256364214029, -224621596044, 13404534237, 90549665910, 3074813136, -7909104051, -917659449, 194098437, 211141890, 20006190, -2215971, -3669129, -782244, 832275, 92904, -18009, -4023, -1665, -81, 63, 30, -9, 0, 1]>],Snew);
    return Vf;
end function;