
// Make newform 546.8.a.m in Magma, downloaded from the LMFDB on 23 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_546_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_546_8_a_m();".
// 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_546_8_a_m();".
// 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 := [1050512243200, 9274302080, -12910499, -197669, -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], [-89873684320, 681717104, 2071899, -8374, -1], [-347970025760, -1218996224, 3467061, 8374, 1], [-479920256704, -1474509076, 14311251, 18566, -97]];
    Rf_basisdens := [1, 1, 11077920, 33233760, 6646752];
    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_546_a();"
function MakeCharacter_546_a()
    N := 546;
    order := 1;
    char_gens := [365, 157, 379];
    v := [1, 1, 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_546_a_Hecke(Kf)
    return MakeCharacter_546_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+1)]];
    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], [27, 0, 0, 0, 0], [60, -1, 0, 0, 0], [-343, 0, 0, 0, 0], [369, -7, 0, 1, 0], [-2197, 0, 0, 0, 0], [11286, 11, 2, 0, -1], [-4114, -69, -2, 0, -2], [14891, -53, -4, -1, 3], [26010, 0, 7, -3, -2], [65975, 219, -1, -10, 10], [82175, -245, 16, -49, 14], [34668, -748, -8, 44, 26], [177194, 570, -53, 35, -10], [152652, 817, -93, -39, 15], [343183, -1495, 77, -222, -78], [120783, -306, -52, -179, -23], [1233775, 3078, 201, -30, -114], [1097536, 3634, -320, 36, 160], [-315502, -3530, -124, 12, 36], [420070, -26, 1, 563, 182], [1271477, -653, 161, 230, -244], [1058572, -337, -377, -171, 13], [2645547, 1703, 769, 32, 488], [4462697, 8965, -719, 584, 348], [755857, -3420, 74, 1509, -519], [5568989, -8523, -1144, 1427, -482], [87567, -3104, 182, -39, 689], [9919819, 26747, 634, -187, -334], [-1318023, 47645, -907, 8, -750], [1311210, -19478, 956, -3294, -196], [-1881551, 23392, 1095, 4576, -918], [-2478880, 85248, -1831, -6303, -1389], [853484, 63340, -2184, 1988, 2198], [-13233939, 24872, 1704, 2285, 987], [-277299, -104018, 2403, 904, -444], [-3225553, 12528, -2941, 1992, 556], [-14521038, 10974, -4340, 7666, -1016], [17502901, 173998, -1181, -5044, -3881], [24768981, 91948, 632, -7245, 4757], [21075960, -79791, 4817, 4085, -423], [15288512, -114016, 5248, -11134, -3458], [13654020, 80776, -6503, 17513, 2503], [14842866, -496010, -1424, -3924, -2134], [14004439, -221010, -782, -15831, 5913], [23271987, -44473, 13896, -2067, 122], [-6963524, -205304, 1827, 529, -2614], [-64635433, -226981, -18167, -14076, 12278], [-14875231, -125862, 6478, 26729, -10887], [-8493272, -237870, -6902, -7980, -6006], [19148527, 121609, -5421, -7112, -11848], [51655712, 464678, 20712, 8454, 3942], [-28886421, 163145, -14163, 2646, -1634], [13446569, 603366, 7417, -11078, -17188], [98601885, 121594, 3890, 34929, -9849], [7345004, 304049, -3275, 39305, 14731], [56863495, -35746, -11854, -24093, 17523], [-28445222, -17586, 30228, 18674, 1148], [122135623, -200943, -17835, -36170, 11972], [-118602453, -889658, -27212, -26793, -1633], [153798178, 250986, 15302, -5576, 14582], [23839249, 118779, -19295, 40434, 6568], [154189459, 865839, 25343, 25358, 21620], [-43761684, 384598, -10216, -124184, -716], [21102702, 2148336, 222, -9226, 20646], [379633637, 1123358, -6758, -25861, 4717], [-36591748, -220272, -21838, 1310, 17412], [11042468, -2302413, 17512, -49350, -25492], [351087537, 313000, 59012, -87467, -26279], [461311365, 1762745, 26541, -59600, -13832], [-128149124, -1524408, 2782, 36634, 47876], [166584586, 1494714, -18712, -69064, -29912], [-9179834, 366998, 1558, -117340, -2636], [538403256, 772716, 104490, -2200, -35868], [82881386, -908664, 1088, 171278, -45332], [-480483804, 2500097, -24634, -11582, -10269], [253916266, 1281058, 47970, 195474, 25140], [362031959, 1484237, 100897, -59170, 38882], [-12498065, 708088, 55082, 30205, 56369], [-290806726, -4207048, -37731, 72135, -16816], [-866314953, 587670, -36037, 44634, -8960], [-239606284, -4622748, -120852, 8634, 51760], [-732003536, -1902578, 21870, 113756, -79810], [207143260, -4093240, 65022, -98472, -85610], [-299964239, 2595435, 19186, -13543, 62928], [147774752, 6401519, 82845, -106767, -27585], [-281721984, 2034664, -44911, 38405, -107361], [-254477596, 4078986, -146852, 100514, -111406], [-1927467113, 1397282, -40327, -22004, -37718], [-1151554117, -2027476, -139187, 119796, 164500], [196309909, 506738, 98309, -197238, 86060], [-637517579, 396392, -88169, 425632, 84461], [179046618, 4673098, 197230, 50060, -8744], [-962747647, 1777604, 446234, -205089, -41413], [-464738792, 158234, -238674, 436350, 21784], [489186318, 8280728, -197958, -275240, -117942], [-1249241066, 1191515, -181610, 1664, 203968], [-426643410, 890525, 82114, -87408, 51705], [-221183640, 3682664, -333516, 43324, -240142], [-927268805, -2149607, 310496, 532787, 38908], [-2178425723, 8486361, 115149, -312426, 45396], [235955107, -7149428, -94572, -183813, 17115], [975395469, 158876, -41185, 292640, 98766], [-1600033483, 5574245, -45251, -105008, -196640], [-143786245, 2494503, -674761, 483078, -148536], [-801599776, -9726878, 227622, -496144, -497838], [-795680590, 9212625, -28423, -985975, 77635], [-110200405, -8419565, -280763, 751960, 359250], [-163865577, 2894891, -709214, 503465, -3015], [-3294506742, 8729630, 36596, 402564, 265222], [-4746957391, 342695, 426206, 216445, -174124], [-2230059049, 1215625, -28636, -589809, 365088], [-5954264248, 5306782, 3673, -585535, -93837], [-1696402145, -10431694, 368157, 79140, 262456], [-3469490373, 14049628, -277635, 245816, 131052], [-194534563, -16941575, -210687, -196868, -117030], [-5793355235, -8939358, 750967, -271724, -147136], [355904940, 12853156, -212016, 188104, -15614], [-2681126923, 20195903, 324448, -681739, 150754], [-2069134418, 4708191, 1016193, -568325, 211811], [-2322223435, -15575553, -835129, -1141882, 97944], [-6799922360, 21556479, -23092, 24702, 199984], [125944265, -5937156, 1012084, -297821, -352765], [3430249955, -11950399, 81714, 254793, 218002], [673615459, 14172299, 1148815, -261186, -566556], [-5169322845, 8040595, -812173, 739100, -327376], [-5719635236, -3114514, -358674, -731652, 257202], [7180536290, -15111950, 124712, -653242, 387462], [-6627686407, 29170111, 59310, -391499, 86932], [-4914710771, -9326541, -189375, 838388, 760630], [3576735144, -4188176, -589850, 1111710, 630280], [-8664490508, 2864844, -730492, 956738, -346396], [-3559210199, 11227287, 1171283, -377284, 40270], [-13915655493, 26799319, 453727, -1440700, 58716], [7749347113, 1496813, 840333, -1413730, -1231370], [-1049358716, 17385050, 974051, 2021315, -263752], [-6829067559, -24902534, 664765, 230774, -1055716], [-4189515476, 4786247, 765038, -247942, -441000], [11013341327, -23251022, -323816, -392231, 260683], [2005585089, 8291629, 922525, 2110200, -661898], [3910769405, 22750374, -2431815, 980634, 446118], [2901466825, 52005826, -213326, -249001, 41079], [3563882832, -9708114, 908150, 749962, -686848], [872115151, -26291857, 125838, -1406987, 1053168], [-2275132603, 36940502, -315135, -2361080, -1051320], [12481564051, -19721078, -1239560, -219391, 434949], [-502865585, 710525, -139217, -2317264, 1615934], [-372747971, 22978154, -1598594, 2057101, 1969371], [4969272768, -15851822, -1107934, 2806822, -565462], [210777316, -15698172, 1933576, -3450022, -1004436], [-13935816900, 47496592, 628756, 2398566, -318968], [34984217270, -16484523, 295200, -869054, 141909], [-10811521637, 50704575, 662468, -1780619, 549962], [5964496334, -62043076, 312016, 276358, -104570], [5563125877, -1039925, 1366479, 1070744, -887770], [16740345183, -825243, -2021928, -497933, 916111], [-18240143360, 40902586, -642700, 186072, -768602], [11167189933, -58569185, 2068899, -1391636, 532354], [10606029070, 2660992, 1858284, -1777048, -247822], [1471791073, 28828561, -1574541, 1696332, 218806], [8905644967, 1499777, -1816216, 2848819, -347306], [26384574107, 4736107, -1687507, 2449942, 34022], [-4033078271, 10396236, -89677, 1345140, 785616], [23805955762, 383646, -979550, -3548680, -158512], [13915465630, 36721426, -2038883, -1444233, 1648877], [12242416847, 16518496, 3370135, -3915718, -1713485], [14503169128, 39452248, 80638, 4567046, 1219174], [-5462500416, 28894306, 1685106, 4544980, -614264], [-4110142310, -15798206, 17430, 2251478, -3066396], [10320659795, 60867100, -5259218, 1396119, 788813], [6926855515, 15019193, -1814384, -2951337, 1172830], [19439558624, -61963732, 2375188, -3577810, -1879022], [8930584578, -111487627, 1037453, 1176639, 170853], [4540732060, 7119580, -252556, 840206, -2903440], [-1497237771, 18648407, 688448, -3019145, 1626708], [14858788871, -83230196, 3298960, -1483843, 1553907], [29082270362, 40466100, 864122, -969472, -706644], [8182243783, 32642404, 1029276, 3656979, 2830561], [19581291668, 24770338, -2351366, -4002098, -47430], [15222698137, -96404134, 407379, 1375782, -159534], [-12369905213, -14367958, 2086757, -4931748, -215412], [14924032306, -9246546, -2633286, 4162240, -1742136], [20017238798, 37258746, -3000638, -3242766, 2556792], [-8403559097, 98610637, 5574503, -1362390, -964326], [12287101990, -18719478, 3340540, -4686996, -1881974], [41052463, 64100530, -1090908, -1690507, -1254453], [-26215158985, 12208231, -4836691, -710194, -218016], [-6435869726, -63787905, 2294770, -3101880, -511734], [-9383899598, -71561774, -3675914, 7185350, 2886104], [-4224629489, 115231766, 403271, -2902614, -1131927], [-3823632876, -590204, 2428090, 9327752, -1234414], [260643933, -144581035, 3337060, 2728129, 3845548], [-8323379679, 51394703, -349125, -6194376, -1204854], [-2682493440, 128382923, -4982652, 7812540, 4898748], [9545000266, -47150307, 4184383, -13171191, -1542221], [9169551852, 78341991, 5643758, 3218582, -1198491], [-28792673542, -90818592, 1768042, 2523226, 999750], [-4032110905, 18437823, -138817, 7430360, 4273756], [23103929787, 190747419, 531833, -5684432, 694612], [-20996641580, -67660162, 836178, -9582946, -4348306], [-36889508723, 29489022, 363590, -8542521, -1544887], [-4783755869, 68824565, -5936336, -5562079, 894280], [-8131688613, -200049179, -2760583, 1364894, -1919454], [-1398605170, -204870944, 2104940, 12436452, 4012378], [7023802844, 162940423, 7394965, 7564623, 579031], [-23435299813, 21175258, 1309922, 1380179, 4919935], [-1906045409, 79016147, -3253665, 1877902, 1993430], [12440623496, 324085821, 6169397, 1947069, 1857249], [34122071266, -68073176, 2559767, -20487499, -3586377], [-18637771004, -37383428, -4495588, -1101472, 1175262], [-20872215748, -186435103, 1346276, 2376446, 3212632], [38209997479, 393268, -5126558, -9771701, 408573], [-13467508560, -129315496, -404546, 11681950, -1837390], [-11274157635, -49695218, 178290, 6044405, -1737115], [-32096441119, -95815996, -5166295, -5102750, 5231249], [51376084918, -216816926, 5803635, -10640795, -964458], [-38180105657, -100784991, 6765747, 4101686, -35302], [30095400302, 171065899, 4016170, -6664200, -7042417], [-44370087056, -203986570, 5235888, -8804314, -4565338], [20475996061, 117636946, -4733798, 5965855, 6008925], [23668101553, 282400657, -1752117, -11734114, -2858420], [3965173984, 271220494, 3303738, -1090066, -1485564], [-47470723888, -24388668, -1416671, 4347373, 4909499], [-90667789566, 384263794, 3054922, 3955216, 1242916], [23239094241, -146605594, 698107, 7628756, -4220278], [-16220805227, -11525407, 11924897, 3955948, -5445724], [68626553000, -157174133, 1226206, -8268346, 29197], [-73881882636, -142409163, -6464019, 5772705, 1328955], [25149148577, 286787927, -3210174, -1321567, -7887368], [-54282653369, -64649801, 3634848, -2342209, 4371836], [-4583497802, -142506816, 625628, -2141052, 641032], [-13842216358, 30848200, -11068254, -19011016, 2537204], [-73650812189, -192244382, -10065731, 4107644, 11354716], [-63289403704, 182575756, -34074, 12722804, -5993240], [25781202120, 121975006, 5444684, -4365840, 6494512], [-22332757831, 345805468, 2440421, -1543230, -3853691], [94976393469, -539230131, -2050286, -6160681, 479658], [-46613957121, 192703394, -6486270, -1608335, -2863137], [43091737832, -227175137, 664209, 12282989, -6297819], [82590541874, 16717872, -9799256, -21559722, 3167208], [-15375634548, 108043718, -8646484, -15550214, 8218062], [69666156830, 177483214, 7752310, 5622536, 1570168], [24311112925, 130844993, 9850752, -17945877, -3003142], [-4888710052, -121395718, 3407390, -5627600, -14104986], [61631175511, -285947781, 3768189, 4942952, -4086760], [29218338352, 113995310, 12198258, 6859858, 1878936], [155587388041, 88760375, 4945889, 7103306, 5645196], [-7753828372, 199855049, 7596375, -12419439, 12377413], [-3357707882, 111642600, 6924714, -17296984, -10605344], [93920441687, -392055263, -3926784, 5202255, -3582305], [89678549615, 123207491, 2276340, -19693873, -303186], [136046688910, -18187398, 5973990, -1168384, -8859112], [-160895612678, -297580412, -3176094, -2434474, -9433866], [93605809146, -752586686, -13365002, 12798534, -371944], [-11053717075, -305048416, -6743646, 5868561, -6249443], [61526914289, 480513469, -5480526, -17620705, 696064], [1226688995, -162379387, -9932701, 32749360, -702820], [3291954086, -186446436, 865704, 7273926, -1014474], [-53675312137, 1150190, 18841178, -7242201, -1241453], [178840633280, 77140770, -14390195, 774581, 5692328], [-126093614969, -360883965, -9645945, 20825534, 9296792], [92970297698, -73888393, 10255655, -19873707, -15879491], [86630924273, 321262875, 12109367, 2931662, 10515060], [98569873773, 118901798, 4472353, 5683356, -3619456], [127502169316, 392964420, -11806080, 756504, 1383790], [175685106252, 568536058, -9485040, -10516504, -6152376], [65044168709, 41605236, 840114, -13645173, -3202743], [-29941411865, -67886023, 9193979, 3887086, -2611272], [137387053682, -304768754, 4640734, -367228, 4708676], [-83632763692, -170827138, 21677310, -12249324, -6506886], [186804954220, 597324716, 12205036, 15847974, 15270582], [-117524958938, 170454336, 4707878, 20865416, -10065600], [70313096867, -138308461, 9821238, -9158843, -18735914], [-54660324457, -34735047, 29189769, -3170728, -8464966], [-42882232110, -95448670, -11869516, -3309240, -1109808], [44855363144, -248437360, -2576640, -16122152, -2791112], [-104839798369, 248298269, -9330410, -7491499, 15604242], [44799544107, -54824537, 11827956, 67516519, 3720558], [113928130056, -81405242, -5865792, -2198834, 6238790], [-24539919428, 181510076, -36270632, 29175348, 11066092], [-18642329094, 730030384, -5956712, -15866594, -622436], [-24527946555, 145607172, -5948157, -7376036, -890228], [-99290417236, 353824970, -29598406, -29997550, -10962376], [-135350850287, -162967585, 5609821, -11488056, 646898], [149411768395, 908130354, 29590465, 8272972, -13678496], [-261655777870, 376652787, -8935365, -11900655, -4068585], [-30227069274, 169257753, -21318694, -48290850, 8196356], [-115722535407, -4606542, -13622596, 4672069, 22634659], [133925807338, 282700558, 36328566, -10526224, -2487078], [-129491637152, -270219899, -19524990, -7698918, 18752567], [54890578836, 495706374, 15362367, -8112249, 14684694], [-214557553023, 79538808, 14272009, 20859790, -8344264], [-22537990168, -81640542, -17878793, 49967419, 11005829], [80056937528, 19965015, 16358237, 31035791, -6595739], [-87982266093, 115745863, -13726221, -56461500, 6259276], [-117227387727, 548557626, -36857564, 36290851, 3582231], [29903687342, -953589942, -12302718, 40884240, 1529840], [91942638385, -243869992, -31598000, 12883003, 11876209], [56649746479, -655999684, -16528391, 57708988, -7171854], [-84927242442, -426968673, 14195320, -38879626, 25082660], [205540251716, 493320270, 16048356, -25497590, -5055536], [118141008387, -84698560, -32076720, -16040301, -1449081], [90746982541, -160421431, 28091963, 37845068, -5973004], [78827952282, -137498789, 5137963, -2963059, -7890493], [-124616610400, 667125838, -2658419, 39670143, -20593156], [-117222714922, 980645606, -1755288, 36109676, -10263342], [-175399649295, 112983386, -1485702, -9891161, 60177], [-11891802393, -828106076, 25320173, -20150518, -5964322], [-114700525804, -812292844, -6423368, -3154802, -20884922], [8883745061, -631556063, 16523317, -1957004, -14239256], [69700542470, -1289645826, 9602626, 66031648, -758098], [-126245151959, 519725984, -7901556, 44261225, 15679515], [209843225796, -1081471964, 8196522, -58933952, 20620152], [124193629264, -394287816, -27308695, -22004553, 13813642], [512333317190, -14986358, -3477522, -22549774, -9865150], [-224447165770, 1126227640, 31675226, -41975802, 1708728], [79655605842, 326771857, 8991023, 8305551, -26614773], [-260484602484, 210116998, -14713760, -18024414, 957300], [217367447660, -393205182, -48898053, 45706447, -3595460], [236863414117, 570581237, -10348107, -19110224, 12262718], [-232533635046, -370599278, -6170624, -64531558, -8095196], [95868421268, -1223521564, -28222258, 38619620, 7867202], [14838415383, 163248834, -19759896, -13874295, -25977], [115244032329, -796835450, -251189, 44507108, -4622216], [156136689304, -61902620, 20511589, 82884273, -21080741], [327725888072, 121385352, -36276216, 40939222, -16512088], [5313326308, 583308362, -20687062, -29599846, 36444736], [109227895050, -1336637959, -24141116, -83247418, 14698124], [47267924700, 456545280, -27295231, 12158657, 3042235], [458743830889, -759656885, 27220172, -38220011, 14214730], [61767657137, 284264973, 19955926, -83834501, 5741470], [111712970052, 1809401138, -6943309, -4891009, -21148206], [170458211918, 402743870, 39019718, 102115580, 7960360], [171563263062, -324436657, 11636527, 92171647, -19731473], [-474642522290, -752396854, 70833678, -5314308, -20030688], [-131798156848, 456492261, 32719045, -30997681, 30030215], [179159365189, -650386901, -23407536, 32337085, -3155584], [-83458646188, -419980574, 5286394, -56707470, 25401662], [94549011382, -261022622, 40833642, 22443870, 27523236], [133030899943, -156323653, 5273590, -43680557, -27681678], [-51726531844, 470044184, 21149000, -50595342, 15488464], [294192801052, 1040606842, -25198296, -45858358, 16451336], [-43989763767, 818910202, -28740313, -36021296, -43592530], [-151299396280, -1601946282, 27839920, 11884356, -40251042], [-146565644931, -986320540, -11628418, -26094181, 32358027], [-77891391275, 378328690, -57199788, -51675219, 23646007], [-632902113949, -215199774, -30987929, 21284508, 11357052], [-32565283778, -90467068, -35791486, 43724360, 28205532], [-283937564180, -125431757, 26869405, 40910651, -32295771], [92628824281, -1988287388, 36797084, -25988285, -10623481], [63684488693, 815542329, 35458457, 52115154, -1113580], [-167054962700, -1412284816, -26978022, -86527792, -29993316], [-278577575297, 1172329492, 35967264, 90642227, -24727405], [-226905765160, 425267690, 48967390, 63885958, -30745214], [-104005979862, 772234284, 81139820, 59391292, -30406708], [84475042978, 1620860973, -1042596, -9234006, 16514089], [22520781015, 2267153694, -30679139, -28052956, 19500997], [-57609776002, -855946183, -55389823, -18482687, -26879785], [-127748051132, 743828490, -23135426, -7167912, 12830046], [221224801882, 21328466, 10759876, 74450956, 29026142], [87242963601, 1126637047, -44944378, 50280579, -50932612], [198162529738, 1481011553, -25549100, -17792338, -13422567], [337347252005, -488161541, -25174348, 105166433, -1756119], [-26261377656, 766014778, 60706076, 85833882, -14186014], [-411804142314, 50232092, 48399046, -10616940, 6256474], [149465621429, 2411435927, 23913655, 19133050, 16151552], [516990886650, 1758123523, 12479242, -848440, 56089188], [316599967709, -856097372, 50672247, -26242700, -23909120], [-53367620040, 121456121, -77008028, 148209774, 26369016], [-524636548435, -980994910, 70965160, 96678005, -31063433], [226419721802, -956850158, -28459730, -81089836, 49103320], [-45795964186, -229911062, 32881396, 88732136, -15675116], [450946284030, 1921639924, 79536067, 11974337, -46267302], [-346516728319, -1659419053, -25353856, -52766317, -55696428], [-810684056981, 597890397, 24695623, -67760224, -9835180], [-539789465841, -258054180, 44286926, -98057953, -45437079], [607852152704, -2458421408, 1700175, -24264341, -51034339], [-155313408163, -1130233971, 55284826, 25363539, -3011734], [-156040119202, -1098929901, -76299134, 49745512, -45394157], [-108245248548, -2128940384, -40059644, 36742590, 38547774], [450216750713, -4596388861, -44587939, 51272758, 6236696], [453709397998, 1383484006, -29182027, 120287611, 60704749], [660257040923, -1852163570, 53981169, -95001048, 23739196], [24108790761, -151901096, -87733922, 9414163, -45706557], [563310323665, -903993985, 57442783, -126684184, -35914030], [57717850695, 734330964, 33439417, 23011888, 26363415], [-272766735785, 1506037830, -5794575, -262876332, -15850376], [208043982731, 846503892, 24442215, -123938140, 53349980], [-245025401260, 324018878, 72973082, -119361990, 4319912], [256924854, 1758326264, 109692134, -45874608, -39849128], [-94003866170, 773468668, 18018924, 31529820, 88335048], [159608290777, 1751031257, 18590247, 69379376, 62181158], [181878764862, -888991330, 86713176, 133935728, -10151124], [133706680854, 201064330, 130338142, 66138140, -50773226], [-361058799626, 2059174824, 62734790, -71319802, 33420184], [229034521203, -1808200771, 78196869, 84839490, 13534824], [-1006630670782, -1890420850, -77243904, 86807534, 109176488], [577342904664, -228647079, 16370452, 116519196, -30614525], [718353635978, -394470400, -62213971, 143412837, 27563596], [-744354608591, 999641378, 44961044, 22000289, 14706923], [123255535095, 476952191, -95806351, -120217458, -3682730], [-369392540983, -1082065367, 42805129, 43070092, -89360136], [-321216838325, -854970316, -78630019, 91814756, -28009388], [313347699165, -1640768581, 94862211, 91616284, 5894796], [-324573875455, -1450589253, -129610819, 28130266, -895568], [-121659227003, -2218762635, -81968468, 44676959, 39120810], [-474977270448, 1617994400, -4514900, -11484346, -45981080], [-82249124368, -1941325588, -73484695, -9509067, 23335519], [163707912694, -3573088427, -6870448, 2272518, -50883468], [-898340372968, -116009071, 113791531, -119916903, -10554589], [780992843388, -786665630, 68915538, 174427116, 56849176], [713682704942, -1914986606, 69448477, -49815285, 4021044], [388449614482, -1877416401, -71799561, 66233117, -25972975], [-11245280391, 1358245653, 4032056, -77558181, 91728186], [54467589120, -3385109795, 121602060, -141855218, -92399204], [-11023059573, -1398859350, -93718140, -223257971, -11849975], [-831328616146, -2020444090, -14714578, -57915774, -36564842], [-48246100675, -1420271257, 21773464, 84875927, -102939564], [275291307010, 1100776508, 140902074, -115426024, -54397202], [-181697554128, 3444907464, -60642004, -99215072, -89415664], [-1085203256892, -2403165942, -65883641, -3493349, 41782502], [680681558026, -132170314, 24263050, -191187438, 63411480], [313572310602, 1340374316, -8544350, 54320150, 2088104], [420054102578, 3912572636, -28533000, 85431290, 126918170], [-249218881847, -3739680769, 81404694, 11435359, -145885496], [369960055461, -1944717341, 99256569, -82895218, -20722816], [-456575724948, 1015207565, 7473063, -8417621, -48887441], [305407938091, -1507144416, -36757742, -235643751, 74326017], [-162396803888, -2239988531, -187442104, 186394980, 68833662], [-446568648540, -1322667852, 8986372, 1361812, -10171058]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_546_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_546_8_a_m();".
// 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_546_8_a_m(:prec:=5)
    chi := MakeCharacter_546_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(2999) - 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_546_8_a_m();".
// 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_546_8_a_m( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_546_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,8,sign)));
    Vf := Kernel([<5,R![-1518560707600, 5654153000, 46352519, -161909, -299, 1]>],Snew);
    return Vf;
end function;