
// Make newform 62.8.a.c in Magma, downloaded from the LMFDB on 05 September 2025.
// To make the character of type GrpDrchElt, type "MakeCharacter_62_a();"
// To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
// To make the newform (type ModFrm), type "MakeNewformModFrm_62_8_a_c();".
// This may take a long time!  To see verbose output, uncomment the SetVerbose lines below.
// The precision argument determines an initial guess on how many Fourier coefficients to use.
// This guess is increased enough to uniquely determine the newform.
// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_62_8_a_c();".
// 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 ConvertToHeckeField(input: pass_field := false, Kf := [])
    if not pass_field then
        poly := [24429360, 1742092, -17755, -2617, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [-1219152, -25424, 2237, 20, -1], [6055824, 158580, -10847, -126, 5], [1042716, 23903, -2068, -20, 1]];
    Rf_basisdens := [1, 1, 1352, 2704, 338];
    Rf_basisnums := ChangeUniverse([[z : z in elt] : elt in Rf_num], Kf);
    Rfbasis := [Rf_basisnums[i]/Rf_basisdens[i] : i in [1..Degree(Kf)]];
    inp_vec := Vector(Rfbasis)*ChangeRing(Transpose(Matrix([[elt : elt in row] : row in input])),Kf);
    return Eltseq(inp_vec);
end function;


// To make the character of type GrpDrchElt, type "MakeCharacter_62_a();"
function MakeCharacter_62_a()
    N := 62;
    order := 1;
    char_gens := [3];
    v := [1];
    // 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_62_a_Hecke( : Kf := Kf)
    return MakeCharacter_62_a();
end function;


function ExtendMultiplicatively(weight, aps, character)
    prec := NextPrime(NthPrime(#aps)) - 1; // we will able to figure out a_0 ... a_prec
    primes := PrimesUpTo(prec);
    prime_powers := primes;
    assert #primes eq #aps;
    log_prec := Floor(Log(prec)/Log(2)); // prec < 2^(log_prec+1)
    F := Universe(aps);
    FXY<X, Y> := PolynomialRing(F, 2);
    // 1/(1 - a_p T + p^(weight - 1) * char(p) T^2) = 1 + a_p T + a_{p^2} T^2 + ...
    R<T> := PowerSeriesRing(FXY : Precision := log_prec + 1);
    recursion := Coefficients(1/(1 - X*T + Y*T^2));
    coeffs := [F!0: i in [1..prec]];
    coeffs[1] := 1; //a_1
    for i := 1 to #primes do
        p := primes[i];
        coeffs[p] := aps[i];
        b := p^(weight - 1) * F!character(p);
        r := 2;
        p_power := p * p;
        //deals with powers of p
        while p_power le prec do
            Append(~prime_powers, p_power);
            coeffs[p_power] := Evaluate(recursion[r + 1], [aps[i], b]);
            p_power *:= p;
            r +:= 1;
        end while;    
    end for;
    Sort(~prime_powers);
    for pp in prime_powers do
        for k := 1 to Floor(prec/pp) do
            if GCD(k, pp) eq 1 then
                coeffs[pp*k] := coeffs[pp]*coeffs[k];
            end if;
        end for;
    end for;
    return coeffs;
end function;


function qexpCoeffs()
    // To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
    weight := 8;
    raw_aps := [[-8, 0, 0, 0, 0], [6, 0, 0, -1, 0], [33, -11, -2, 0, 0], [-23, -23, 15, -5, -1], [-794, -65, -12, -83, 5], [-1426, 150, 84, -33, 52], [-5954, 63, -224, -16, 217], [-1757, -68, 734, -16, 169], [13610, -59, -1018, 80, 3], [57284, 982, 3068, 77, 590], [-29791, 0, 0, 0, 0], [135654, 593, 450, 1217, -653], [42629, -10474, -5109, 515, 748], [471068, -5364, -870, -6429, 2960], [-80870, -10917, -1077, 2985, -5214], [201816, 3383, 4282, 10483, 8115], [-74423, 28128, -28484, -6304, 14925], [-985430, -29404, 35084, 51, 12386], [565092, 13414, -66070, -36802, -372], [-105399, -38630, -7806, -23492, -6471], [1592282, -7976, 9426, -18134, 31594], [2081680, 35499, -3462, 162, -23013], [-2416042, -91549, 16450, -15383, 31867], [4540452, -53725, -47048, 7126, -34145], [-1606329, 27386, 425, 170781, -52224], [-6891771, -46287, 273586, 66284, 39516], [1189585, -182720, 131830, 143388, -9857], [-4705985, -115600, -152712, -61552, -37105], [1259403, -281249, 101428, -119004, 98618], [2604399, 548354, -143125, 96615, 17746], [11284018, -423434, -108304, -195778, 123560], [-10896880, 478466, -407838, 83066, 153132], [4638186, 629955, 45034, -349834, 31483], [3305110, -301019, 44406, -388871, 213541], [-31064214, 102334, -547340, 81846, -61810], [-8182252, -177385, -869612, -141032, 138893], [7892363, -53467, 359266, -7610, -340782], [-22276497, 199692, -289412, -250396, -520673], [-16728628, -905554, -88892, -94532, -246478], [-14790418, 640800, 144592, 196808, -369672], [-24170506, -600964, -1883752, -609129, -215444], [69606114, -643192, -696952, -795759, 505670], [-77750175, 1155605, 535693, -146675, 567081], [42681241, -1346919, -429330, 596922, -788380], [-3600892, -3110987, 1304470, 83949, 503833], [54891622, 2734816, -928854, -254042, -798344], [55645965, 969330, 724090, -931714, 645165], [-28270496, -2183576, 3683830, 1033524, 940538], [36771716, 874380, 1110056, -1236866, 856640], [75678994, 1793751, 117998, 2414425, 550853], [27436843, 875256, 2621551, 481631, -1134588], [-115726616, 142243, -2665010, 1618002, -964697], [112502458, 1223932, 449260, 543282, -1073916], [28981972, -2433652, -5176782, -580225, -1081288], [-85780407, -230003, 3037824, 2848552, -693766], [-160659174, 2155147, -754890, 86338, -1072471], [-208937688, 811047, -5420322, 324381, 1148603], [-121073188, 4540579, -1011216, 1903732, 324541], [261233828, -6358790, 4106616, 3753367, -2452702], [-15160263, 9570675, -7773882, 815994, 1410898], [-182345536, -736620, -2589842, -6482836, 880466], [181614954, -1088802, -2356664, -1344088, 3803470], [28466131, -3119204, 1429850, -421282, 886553], [-137329803, -5500078, 1632782, 1421820, 5981889], [219411422, -7165405, 32624, 1541196, 4737989], [233154661, 4751059, -8869148, -8882034, -197140], [-379141614, 4149771, -2618174, -5435359, -6282137], [29868928, 2778119, 1320338, -5821932, 1109889], [269831386, 11798822, -207484, 8902899, 425234], [-316288950, -12394214, 3004384, -606702, -3097994], [62724380, -8437570, -4396558, 9753702, -1311946], [-20950057, -28569273, 6783787, -9736213, -1451037], [-41784626, -267016, -6645650, 2948578, -6748028], [351598435, -17291787, 11160846, 8816790, -449066], [-687566612, 10539298, 6606892, -1387350, 1296822], [960205990, 14574518, -596674, 9229392, 2997026], [223955392, 32179437, -5342526, 1908999, -152531], [-606209251, 21510755, -1823292, -9477430, 3955628], [1063583228, 11118243, -16673272, 3841756, -5464821], [-991648554, -45125673, 3513434, -5168210, -2975693], [-588044147, -43019568, 13994834, -2958218, -6339921], [422687345, -17416897, 14174310, 3726380, -304114], [556407906, -37490277, 4272565, 16573595, 7786836], [-721304084, 30624741, -23615206, -875606, 8362891], [229929851, 665383, 11747405, -16007287, 8051697], [1989166691, 56618086, -40615788, -2234606, -4221107], [-382263190, -27889656, 10048340, -22612106, -9396744], [448740444, -55326754, 17736054, -22161712, -4107138], [-1264796930, 37417719, -25679762, 5303525, -7687335], [17865510, -22038796, -7892424, 2200052, 8939754], [-946669599, -33652194, 54658796, 13040716, 4943967], [-250676729, 35950642, 32041802, -5737384, -3996769], [-460363446, 5545297, 1566912, 13058644, -5215931], [875655848, 54030579, -53864662, 16039285, -15715315], [-1232245914, -14374851, -49721496, -398331, -25610141], [239721921, -17722490, 12966158, -14990080, -8643103], [-583904416, -22231682, 31252596, -35553995, 19527426], [-452865690, 5514202, 11975026, 28571838, -19685196], [-452041578, 33553556, -72742210, -25885335, 16593570], [1471741799, 12394789, -16041928, 35269124, 4004820], [2278503767, -26653280, -49272948, 15276124, -21717197], [570613020, 45501743, 14664798, -38785171, -340897], [-519656607, -36108816, 9500076, -50429274, -3599367], [1416019492, -40084340, -16644482, 18891300, -21455504], [-2627828670, 33824478, 18292262, 69837079, -29491280], [-2293789032, 18307297, -73063303, -2546935, -2030350], [2452782536, 15420463, -21708088, 7404209, -6443245], [-338866407, -23097970, -53505119, 13448077, -14305042], [-331893027, 28663111, -116582099, -25759587, 26680931], [-1716062420, -175933171, 30182462, -57731832, -29786301], [-3829216460, -61372374, 19123932, 40297356, 17672094], [-1158904474, 136304919, 10228278, 26807271, -17763379], [360385674, -59257652, -40124182, -89942686, -660978], [-2883192236, 97460252, -41453906, -83050289, 37285852], [-1028910406, -3236028, 48456866, 39008752, 19954820], [2658401944, 89721538, 23960722, 96995172, 11135642], [-963838418, -349455, 40854786, 31444461, -38697963], [2408030920, -83619332, -57305398, 7314164, 24106370], [5177431338, 149684012, 59066572, 68743450, 42434096], [1972001981, -140182206, 43657010, 82550872, -33105847], [-7118044349, -20470809, -31950474, -26623878, 5404860], [6585462692, 67637297, -74767284, -43532464, -42979695], [3337080906, -67951473, 11841594, -32497617, 1489757], [3151391351, -115388774, -22197568, -63735184, 909693], [4529823913, -271105148, -39145926, -30183572, 26250987], [7097849971, 87280415, 14158736, 75795012, -7309866], [-6622229508, -250881015, 218465710, 61929137, 33338101], [2539954008, 125636587, -206523948, -32248010, -15550015], [7569944185, -260128790, 129958574, 44343944, -89247883], [-4654307319, -219379729, -34888878, 10598120, 59522554], [-566729008, -153010558, -85188616, -11264475, -29840180], [1347470908, -55267953, -160047826, -16989302, 3160775], [3077889931, -153243395, -149758499, -3592815, -77711301], [-2317143792, 209694180, -214437344, -17294857, 47650572], [323278706, -126947042, 178840020, 87121462, 49462618], [-4699797649, 237090860, -154215303, -64730503, 134453862], [-702109616, -336333026, 201100340, -112163743, 64779698], [3820334920, -424134590, -143969116, -68888959, 36155104], [-5856445608, 154053881, -226083278, -135620831, 24868301], [-10602863800, 117326078, -279549480, -43951594, -4764508], [-4810205704, -89051604, -111878370, -30645348, -120528638], [9917886316, -1336002, 120060812, -11828819, 97300118], [-7262935502, 55935849, -301443860, -126983224, -49144895], [-7987433058, 268648126, -152370510, 153986671, -16145216], [565206554, 26468009, -67645918, -157743279, -36108529], [-7313394834, -220373421, 471810969, 57428607, 28470548], [11998372670, 51659878, 69631250, -11385268, 6146168], [1074618218, 27053114, -101339094, -168486478, -51535576], [-16473392768, -227278307, 181757984, -28964299, -28675851], [5929983248, -214739369, 200444278, -79209138, 159695563], [-4103248919, 118996873, -426546454, -140181520, 172588352], [12697207320, -501026712, 247862816, -291423536, 30840934], [2356802636, -384716619, 100229874, 161642469, 65470151], [2402936405, -526922091, -249059209, -194851961, 42962751], [6328198265, 205345194, -108817060, -104965868, 7758195], [5148845364, 430119265, 294453062, 218855924, -19987863], [-11968688180, -662557262, -21800312, 86357064, 63941778], [-4042256528, 532562442, -191071890, 115299348, 13476334], [21790029106, -447958446, 126401762, -15016394, 40223288], [-4853257326, -267002577, 593422254, 216594315, 5644209], [4929575174, 551687913, -320817510, -98546193, -83101039], [22591588766, 36695875, 184854804, 216273136, 219542217], [1155341112, -327474932, 441137764, 99501474, -202502588], [-5434725664, -85750046, -142685898, -15371654, -176835600], [-9077357, -722093103, 313996168, -326615236, -67263864], [-10440625122, -191359888, 684099506, 237588588, -14458204], [16649722498, -476183301, -32436130, -276612296, -43153315], [-25205429517, 90475673, -624907704, -322473760, 72815948]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_62_a_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_62_8_a_c();".
// This may take a long time!  To see verbose output, uncomment the SetVerbose lines below.
// The precision argument determines an initial guess on how many Fourier coefficients to use.
// This guess is increased enough to uniquely determine the newform.
function MakeNewformModFrm_62_8_a_c(:prec:=5)
    chi := MakeCharacter_62_a();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 8));
    S := BaseChange(S, Kf);
    maxprec := NextPrime(997) - 1;
    while true do
        trunc_vec := Vector(Kf, [0] cat [f_vec[i]: i in [1..prec]]);
        B := Basis(S, prec + 1);
        S_basismat := Matrix([AbsEltseq(g): g in B]);
        if Rank(S_basismat) eq Min(NumberOfRows(S_basismat), NumberOfColumns(S_basismat)) then
            S_basismat := ChangeRing(S_basismat,Kf);
            f_lincom := Solution(S_basismat,trunc_vec);
            f := &+[f_lincom[i]*Basis(S)[i] : i in [1..#Basis(S)]];
            return f;
        end if;
        error if prec eq maxprec, "Unable to distinguish newform within newspace";
        prec := Min(Ceiling(1.25 * prec), maxprec);
    end while;
end function;


// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_62_8_a_c();".
// 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_62_8_a_c( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_62_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,8,sign)));
    Vf := Kernel([<3,R![431251200, 24510792, 62508, -9650, -28, 1]>],Snew);
    return Vf;
end function;