
// Make newform 546.8.a.r in Magma, downloaded from the LMFDB on 24 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_r();".
// 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_r();".
// 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 := [-21984668630064, -1787613752904, 15113237808, 17519669, -264981, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [4879576437327548348, 5894885053583340, -255406399982096, -75579217837, 1394854154, 664523], [127070152402416763344, -1985763386887708920, -2839343780808048, 22419068741319, 15607782922, -46974981], [622583957722034939344, -18222872340416428280, 22794539601833512, 392168012091729, -237883755898, -1679580891], [-172782684689345739792, -11225303835486719880, 28322557881942504, 256239695015823, -205637389526, -1123997957]];
    Rf_basisdens := [1, 1, 1355267466296380, 27105349325927600, 108421397303710400, 54210698651855200];
    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, 0], [-27, 0, 0, 0, 0, 0], [34, -1, 0, 0, 0, 0], [-343, 0, 0, 0, 0, 0], [-448, -4, -1, 0, 1, 0], [2197, 0, 0, 0, 0, 0], [487, -10, 0, 0, 3, -1], [-2173, -23, -5, 4, 2, 2], [1923, 15, -15, 0, 4, -1], [-15342, -139, 34, -7, 16, -45], [-13849, -75, 6, -27, 5, 23], [-44099, -636, -12, -12, -39, 34], [-61079, -976, -33, -48, -22, -90], [75998, -861, 36, 91, -44, 41], [122466, -787, 63, 23, 57, 68], [-262839, -697, -100, -65, 151, 11], [343303, 2622, -37, 98, -166, 195], [-44844, -1416, 219, -67, 37, -243], [-126730, 938, 306, -32, -44, 658], [-1022999, 1292, -85, 180, 676, -662], [1060930, -2765, -178, 273, -736, -323], [-148863, -9683, 62, -751, -85, 851], [551344, 3313, -1657, -325, 423, -890], [1867538, 5257, 817, 189, 793, 1115], [4778503, 12413, 840, -335, 701, 111], [6359088, -13770, 950, -560, 628, 1119], [-237823, 5518, 1416, -1920, 931, -1898], [6322832, -12082, 1636, -824, 556, 1997], [4168583, -3538, 1894, 186, -1111, -2402], [1986035, 4209, -440, 1155, -1131, -1905], [-388880, 23600, -406, 1612, -2570, 5096], [6109914, 31928, -8313, -177, -699, 571], [11972631, -17588, 1810, 565, -341, 418], [3740962, 110410, -2052, -924, -1842, -3272], [5655379, 20542, -12241, -3646, 8468, -8635], [-7702836, -9952, 2553, 5173, 5209, -6999], [-3329406, 62366, -11513, 1527, 12631, 4597], [14036256, -163192, -3206, -5064, -1294, -9116], [8378289, -37911, 9095, 2315, -3818, 8526], [20268872, -95896, -3346, 12606, 2896, 4937], [25455235, -298301, -232, -1945, -2941, -12466], [56606762, 102236, 10116, -9836, -2768, 1134], [4155330, -83674, 8317, 1933, 15179, 9118], [79333124, 47572, -11940, -4788, -22758, 13384], [33459263, -177066, 12275, -3056, 4248, -33615], [25919933, -62938, -21566, -6672, 22581, -17116], [65536210, 174731, 29902, -14397, -18634, 12917], [88823535, 288423, 39902, 6603, 985, -15549], [79942423, -5318, -1111, 28932, -1472, 5353], [131041188, -180056, -13566, -18806, -2716, 3750], [120735431, 348671, -35076, 1833, -9423, 27395], [34336673, -46404, 5927, -32048, 5928, 6932], [153349075, -424891, 4244, 19461, 9957, -26981], [69309240, 545162, -16257, 9813, -3845, 31539], [8924182, -563722, 5026, 5676, 21990, -11839], [39238333, 294181, -79396, 3987, -31031, 3920], [95809882, -565208, 25608, -31840, 40864, -37579], [-2398834, -72200, 20324, 6652, 30846, -12682], [-59036471, 460809, -30066, -52509, 48093, -27535], [-9814219, -156170, 11467, 28258, 70794, 8313], [67772606, 156684, -39702, -12606, 46272, 55700], [65353208, 307691, -11663, -11347, 23927, 53751], [-232503387, -246185, -83770, -43215, 22171, 33731], [380122068, 138306, 27528, -5376, -113676, -26032], [9134602, -396768, -63106, 86358, 20462, -65400], [-145407729, 416592, 126761, -57868, -95134, -82419], [-46357200, -206046, 181128, -40226, -145656, 63414], [-69444921, -1410559, -144635, -8164, 25130, 133942], [-380416650, 56418, 21100, 94234, 17386, 66499], [176723021, 120229, -41194, 50409, -237227, 35131], [422669677, -89088, 109321, 55290, -94216, -30354], [-358020271, 544100, -119513, -23516, 212224, -141174], [-99711268, -597766, 58086, -77974, 2234, -105904], [-235554374, 1819412, 47606, -91706, 74098, 87668], [-469920674, -938314, 75064, 26316, 49166, -32206], [147680052, 3578312, 63807, -5648, 63213, -207079], [-66982860, 967316, 43338, -14490, 27412, 218426], [-45717267, 390061, 77314, -131955, -61767, 63287], [214612485, 1298400, -265931, 207112, 201228, -12871], [499902928, -1372161, -86674, -152219, 87834, -135915], [-319678968, 1350138, -12891, 35639, -69575, 175869], [-497094860, -4150166, -184436, 177300, 238958, -32390], [-20250225, 33578, -54863, -235118, -138372, -88302], [26886594, 4533978, 148792, 47086, 205748, 246544], [-578052685, -417184, 240804, -91870, 63649, 117030], [319563035, -1791553, -69850, -35853, 170877, 464836], [-51509915, -726724, -180464, 143433, -16353, 298878], [-71682178, 2101694, -237660, -51780, 193280, 236618], [102181409, 796636, 24672, 108637, -58685, -341711], [-676008856, 673514, 395319, -155221, 116339, -672769], [-1066554612, 519434, 237235, -138723, 381739, -670353], [1437699369, 2056177, -141299, -175589, 13712, 101460], [-610910364, 5195702, 81162, -53670, 182350, 434252], [31403204, -4426374, -152680, -114140, 501620, 279223], [-415416034, 6619064, -496446, -265614, -39272, 155690], [-481841722, 3632810, -44234, -294594, 29864, -357440], [-507035522, 2011127, -108126, 353030, -346178, 318458], [1241108991, -3420710, -25802, 155360, 438413, -12007], [-593448618, -4064278, 400268, 116984, -807614, -115948], [-631705567, 9447976, -16722, -5104, -540101, -620428], [-280602223, 3532259, 390002, 180933, -431693, -241649], [-76602373, 5897224, 343757, -209082, 64430, -430911], [-2695036204, -852940, -803615, -92025, -134863, 15531], [-2636969693, -10838297, -684082, 508463, 636999, -287947], [-1149917015, -4769979, 276968, -12097, -229215, -242591], [-62412002, -4025096, -536424, -561378, 314440, -271154], [-1476478578, -8375, -238763, -4879, -14953, -30850], [-2069411634, -6594789, -318901, 263405, -1032253, 268825], [-1987094677, -6641173, -995741, -196682, -107210, -769133], [1794817248, -15257572, -762644, 227868, 784374, 504310], [-2063322929, -15209428, -414436, 288422, -679683, 241458], [-269982149, -6975732, 439632, 660828, -285169, 647530], [-1594736171, -10789062, 1154044, 178205, -790453, 1154830], [-2040780786, 3920188, 100991, -802123, 1109621, 753777], [-779069742, -6450822, -347359, -793885, -80505, 1512549], [-5960805783, -7712907, 1376562, -468281, -815171, 630527], [2290934222, 7810492, 147757, 4035, 624515, -779135], [-2360619328, -10345022, 1466746, 97484, -884306, 15358], [-3505557857, -16252622, 272744, -64824, -43357, -567820], [-2911836399, -5556611, 925930, 141483, 323243, -741580], [3969114871, 19872925, 80752, 511203, 779885, -1395963], [-1446650541, -692579, -1245495, 438100, -287670, 804504], [-4239962482, -3134038, 1809394, -232870, -1233858, 775307], [-5932075664, 4175982, 875503, 659910, 981533, -1244828], [-43822371, -19982017, -1076158, 70445, 1303407, -1894375], [-2683698969, 22064245, -308336, 287141, -1123567, -1114393], [-1161510542, 29643548, -647336, -315066, -518880, 2087896], [-9073719088, 15995830, -895304, 890552, -649144, 1531666], [6434288225, -6174140, -549374, -184194, -25667, 1850988], [1887087877, 10697049, 2515976, 150893, 363923, 2727531], [-1275385228, 18001810, 716900, -1068118, 2367176, -551532], [-3023284629, -5739292, 1497827, -2086824, -1350342, 2596210], [-736698305, -14939779, -248306, 421891, -566191, -1926677], [3581433807, 1264729, 701780, -96683, -578619, -128195], [1280074166, 21423243, 2414553, -36479, -220139, -2659711], [10735727828, -388135, -1417252, -201069, -176308, -1717545], [-1852943173, -245292, -257850, -327835, 412179, 1508431], [3237382313, -1837855, 1388037, -912628, -798582, -151514], [-145632416, 29790182, 2185702, -154834, -714096, -2049477], [-9871145, 14209749, -3817008, 1212779, 2303713, 966727], [12047213360, -23272888, 1278645, 851757, 175221, 53071], [-9394993659, 12838342, -156223, 193804, -786108, -956773], [-2524585898, -18245060, 945350, -1471662, -1964144, 2952526], [593742562, 45828714, 1041643, -258830, 182615, -1749778], [3731042768, -15948716, 214203, -2732283, -545791, 2176627], [5842469911, -3144646, 1126519, 943654, 327546, 1278915], [6390124821, 15150531, -2875618, -595373, 1283121, -3277975], [2172576950, -24667506, 4285142, 101968, 2223618, -2006295], [11614351054, -7586214, 288792, 692238, -3364902, 3660772], [-16135769603, 27258948, 765089, -1191760, 852818, 1564034], [3267180306, 29870178, 2809982, 890968, 495998, -4680324], [7037429743, -3937980, -2770482, -1475878, 40473, 1763743], [5188951545, 16442342, -4008856, 1420460, 1365935, -2014296], [-2580781404, -27860908, 1233276, -2048792, 2347888, 386346], [-3634678151, 17985913, 2168904, 245387, 2064385, -2413981], [-4813537469, -12759831, 4731961, -3054800, 1451772, -616349], [8595829264, 15815680, 2137406, 1986264, -482742, -1213058], [-6778304752, -39316477, -5380777, -2045489, 754641, 3740699], [15485489682, -25811834, -3684502, -1238980, 4418590, -755162], [-929239658, -27072895, 3420253, -4419101, -1711079, -1257609], [-8892561982, 55481596, 336697, 632784, -4275483, 3975206], [-1597438067, 82172857, -231664, -1218781, 1485507, 2205543], [19662923658, -42069386, -140693, 240293, -2268031, 1457427], [21356396338, -35601902, -637960, 185310, -4368802, 5053330], [-329758873, 4481978, -147138, 1143237, -2789353, -1732804], [-19974398215, -2722511, -4290691, -1656465, 589144, -1808726], [6387482688, -11854544, -4442282, 316926, 928502, -2470356], [23214211420, 27739970, -7343032, 221250, 6289102, -4444646], [4233857718, 2468048, 3643188, 2501118, 3555476, 5429544], [-908252640, 6236672, -4298336, 4599324, 4048914, -2557301], [7487229442, 63224968, 7027773, 951408, -1587031, 3735794], [25326485452, 31634980, -2370602, 2434732, 2519076, 3990384], [-7798874567, 26373193, 5217320, 65743, -1431007, -9371694], [16400763896, 123685882, 2715260, -3053472, -128826, -769134], [-11828219721, -37341882, -2881816, 372160, 2018677, -6904176], [23749768546, -16878344, 7174992, -1073298, 1987672, -9129893], [22072596224, -7209664, -5227154, -2451754, -4888526, 1146356], [-5259981129, 41383306, -3644765, 2155786, -5712076, 13008143], [10024120712, 46178126, 1026022, 3187906, -2850802, -5807526], [14312756888, 62281492, 8340149, 591971, -6846197, -6531757], [-5739114986, 7894324, 2255029, 769983, -7161017, 3150283], [-3705427534, 80404354, -10503120, -549346, -1273010, -3117678], [19067815316, -4557848, 4348010, -382262, -842396, -7995820], [4654503296, 50338171, -3461119, 4575987, 5888815, -9273889], [8463145581, -3522010, -425103, -6433064, 9499074, -8096496], [-12364082648, 245774, -4820110, -2199786, 10333556, 3710339], [2527073907, 23270251, 8902116, -938009, -12151707, 6414713], [-2367678121, 98358541, 2528363, 1207004, -2848162, 10611856], [13415621806, 109845104, -5711496, 150802, 4853816, -10306156], [-18837253947, -149012087, 1115607, -3064429, -6470414, -37880], [22807803278, 27712794, 10595696, -5457018, 6404048, -4353568], [-6352205376, -23089584, 5482683, 6962736, -8141387, 534884], [6769404115, -12186215, -3779418, -418169, 8949625, 4673731], [41331619584, -52714721, 6533030, -1119772, -279668, -5701572], [21769023551, 59557709, -15950488, 3616309, 3773923, 1589998], [9423980929, -57661426, -5115846, 2849996, -3017801, -15614091], [27850282458, 85166220, -1338934, 2037938, 5322290, -14756054], [-6237492597, 42576645, 8880092, 2948381, 3290857, -2551731], [-29323163398, -138520703, 5927805, 359725, -1513491, 2515039], [18643138058, 55256714, -13073168, 3159266, 2213770, -2963940], [-6455381701, 23716456, -9921955, -3885132, 4059426, -984827], [25874248205, 24709078, 3609252, 7931236, 837603, 15244728], [3684304263, 194865201, -12078868, 1926133, -9720035, 2445511], [14570862198, 161714586, 6693974, -3335160, -5430546, 10144938], [12957517934, 87938373, -8539141, 819573, 4333873, -4676238], [8467949236, -142661184, -11475974, 7834188, 10420636, 4403677], [11900446119, -88776723, -9001010, -10620391, -2058683, -1213911], [1779307157, -59080581, 9253206, 6908823, -25913965, 2932314], [1964914401, 249302192, 4483254, -979685, 13557921, -12655428], [-4923747400, 95196814, -5359302, 3135848, -4776174, 12264146], [-23401350215, 40714919, -26271761, 4759808, 723662, 12743046], [7868479674, 144332008, -10299062, 13841376, 5602678, 7367975], [-4275936602, -91593468, -3332148, -10449834, -5639118, -1111704], [-24159827091, 142196178, -5787565, -4446376, 7852512, 9971993], [-26158119351, -275654065, 13599225, 6447833, -4906016, 4968710], [-24333266836, 26421597, 2558368, 923571, -3536192, 12364899], [26494932147, -297168739, -2137424, -3295237, -621389, -7155005], [10434260743, -147351502, -10103516, -3042300, -9199737, 12563747], [-36472428283, 182414904, -2971641, -8489492, 8381588, -8719340], [-59449084963, -96312532, 7825799, -6483444, -2139898, -22837287], [-33949424159, 18923621, -2691596, -11108631, 17974403, 2466131], [-25713918022, -90040208, -8133302, 4512826, 27645512, -1556740], [665653573, -132915296, 17601992, 11209045, -19758433, 18232642], [-19453062172, 5105922, 10274314, 10978114, -7650346, 9734760], [-25590432464, 127618638, 7432169, -20466069, 2324525, 10768831], [15955865433, 55431335, -17149700, 8427391, -19543833, -22223471], [-20594484825, 178801938, -12767088, -4665520, -759021, 5416665], [1479824937, -15027751, 1514448, -1911101, 16281713, -16680820], [-23301784347, 181465172, -18985478, -9075710, 8461497, -17872332], [-69511779620, 113304492, -803259, -6016124, 16801311, -25570176], [-20080555618, 76847220, 12176164, -1972704, -14241324, 2739600], [-11006338806, -103461800, -3887180, -5067870, 22028722, -19929688], [-6877241406, -227326272, 7902101, 2461803, 16915907, 1435997], [6369036726, 210175140, 22495266, -5921478, -24049378, 19423830], [6688793780, 233586298, 6590684, -16670212, -7623268, -6089582], [-36096873109, 281292695, 4184799, 9068181, -8388376, -14772298], [-12644501235, 104400562, -11773300, -1176318, 12582953, 9840824], [-2455497379, -162540272, 12926855, -21293508, 4567862, 7781231], [63143263049, -55566903, 14471790, 1400911, -3407337, -15481974], [15682402100, 27829686, -23883822, 19990688, -7164318, 12326596], [-43381613119, 301173248, -12582561, 17874124, 11743620, 15864612], [-26920735726, 244533958, 7685104, 130606, 4124502, -39129766], [-29939407605, -135446978, 25604234, -4328552, -26009881, 10994388], [-4553392640, -41355596, -10624142, 4664934, -26333168, 44427746], [-38722969438, -126762387, 31454405, -12816055, -14902715, -3810861], [98776262836, 191984596, -3962128, -10920550, -8358040, 5699422], [-52923487627, -108955465, 30543196, 2355151, -25093083, -1557493], [-9070830388, 147423387, -37682657, 24978471, -5919437, -3164578], [-36010185674, -58164232, -23010484, -8390954, 22569342, 24279458], [-39220304611, -40130851, -30072565, -4009840, -2182688, 4887751], [26088568039, -534497352, 13532838, -7300720, 13250093, -10470496], [62058001715, -82490372, -5934199, -15803378, 3595794, -17545230], [-38117620171, -373131350, 8524721, 206918, -36063266, 20185346], [-51129578684, 120566708, -4748106, 19053282, 14069684, -33019430], [-39433318368, -9820302, 633818, 3228224, -20585400, -10241117], [-27237349296, 385083890, 24489311, 7577502, 12487677, -15915534], [-103142558239, -142759629, 35867766, -11268883, -28342999, -21400971], [-49989563782, 254000836, 29768550, -13792996, -26979956, -8260278], [25721527164, -277471800, 42644754, -707952, 9598300, -44448979], [53595715368, 45722123, -919052, 5032581, -1260364, -14579699], [-62859059507, 111757293, -36160048, 13952819, -3894743, 25045461], [28596586369, 45337397, -32673980, 6190821, 38044917, 3195636], [40006910317, 253101065, -62343698, 25387787, 27642617, 17297805], [45368666952, 31571816, -38252501, 12687057, 1776721, 32423831], [-102808075185, 2209940, -40203771, 15324172, 6402190, -17346246], [29747711294, -212749038, 40643926, -22643532, -5455584, -38118648], [98399310965, -203098674, -10487829, 3143912, -8794150, 22478541], [40919218338, -333451343, 22653001, -7163241, 26174645, 7438637], [-170021853890, 204206034, -10706484, -183154, 20050174, -17012784], [-32545235850, -64523476, 414372, 1940566, 32991952, 2100932], [60639217422, -448083280, -28027968, -7136880, -371696, 55466826], [-37308335756, 198866164, 16179306, 2627346, 16384226, 32772214], [14347903359, -214548062, 19437848, -5690394, 33391731, -11816408], [-41092846991, -656577289, -9984002, -1690407, -15059349, -3467583], [-43682369548, 180704978, -28645242, 25691288, -30713952, -2267356], [-114607226880, -190154596, 23646228, 13476916, -15778804, -14047262], [-148061112790, 75685726, -44546055, -8972018, 37057817, 32413860], [-138028146171, 612120516, -174268, -5703380, -19444519, -8295614], [-122459663144, -388771702, 16824502, -12759284, -20628540, -26655092], [134475383602, -98366804, 53327550, 17579148, -20601204, -13355652], [-155189995364, -462245010, 53135678, -7468584, 23318038, 4626716], [-180004764260, 17235050, -45889287, -802407, -25484967, -24459435], [-171192851958, -313030152, 46487782, -5749458, 14514116, -48309802], [-70356003369, 494776009, 24169078, -2031823, 17997427, 64002803], [-70636828306, 112705812, 7659899, 27790961, -34201279, 6293517], [73990636945, 291830343, -5661414, 4522129, 15043563, -20496954], [-147263745999, 234061815, -26344835, -27890462, 22158660, -335636], [68306045073, 165547032, -29745167, -40432542, -29888068, 15615381], [-85078931860, 197114716, 54723448, 1873182, -83030760, 55724338], [77217246175, -558179070, 13430166, -10252868, -14338619, -44676609], [-38476471874, -18824639, 82118140, -24217887, -88740142, -29475441], [-148482080904, -783543048, -35810061, 33988529, -30683553, 13812039], [-47672237385, -263348138, -26859604, -57442425, -14806067, -7576578], [-201094594194, 638146531, 23849557, -1548987, -26933921, 54034032], [119951188975, 723350641, 57121920, -30515399, 752489, -15338865], [194396199360, 713760188, 63223420, -22482082, -12693030, 36699283], [138388326808, -286246, 49075130, -8097990, -15162022, -14257812], [-108496049178, -102763548, -69666464, 44789302, -2304760, 23466725], [60102710800, 6305096, 69351327, -25599799, -23895669, -61157347], [51911591941, 161173805, 90127347, -44373234, -69337092, 4595044], [63485634508, -288311428, -45955040, -7311320, 89794742, 17898268], [70205964809, 386284084, 47159727, 50084674, 12731990, -44069107], [-50795765775, -260223939, 43494362, -34367049, -32049893, -12575215], [3189644785, 24625243, 15355054, -64407239, 27209115, -34127726], [-234146963974, 221270489, -12342456, -3426143, 19794720, -6686675], [149241417926, 1097267916, -17102130, -19552728, 7081454, -38104214], [49908446452, -88473390, 34958226, -25634552, -72777118, -8049799], [17014100926, -457944218, -76241171, -1217887, -44842439, 47069189], [-68005743491, 117984766, 34208891, 71622344, -16326952, 9183528], [110979632121, -621933013, -46124348, 3559155, 84166231, -113269533], [61150130356, -1245160268, -12058512, -1301270, -16874072, -28286740], [125115375733, 33659438, -58085059, 49158686, 52033340, -15247847], [-151868476760, -128851164, 8680340, -1114266, -18207110, 107618202], [-256218221626, 311370481, -32944630, 1222585, -7694038, -48156825], [-231986080435, 50167116, 30049497, 301250, -7244722, -90550498], [-30265021038, -352442106, -26604064, 12232162, 39074740, 25497586], [-43130746620, -202112441, 29407391, 3654499, -3525781, 53318056], [-30252077129, -1192736106, 20474867, -31120848, 6019870, 56108942], [-100786642626, -43081579, 84448898, -15434117, -406852, -102789637], [248664774185, 351048009, 81674370, 5149891, 9510053, -36018645], [-149590910692, -1147868500, -90543066, -1798324, -6859806, 18242198], [153056340370, -673438686, 52611500, -5160150, -58549008, -12777826], [35973055100, -754531958, -120810498, -12446450, -15881380, 69594215], [118386411696, 372345344, -80780411, 42748485, -23596847, 95239925], [-247585858311, -330991404, 58112540, -6133735, -51407097, 25244406], [-122730485646, -762666646, 120062366, 30213800, -25148958, 57814988], [-121928120704, -117539592, -144297572, -46369414, 25958972, 28545806], [27682736983, -131013165, -20336467, -62669726, -12389720, 93287054], [-315891660118, -1112758862, -26114031, -38306587, -19273681, 54172054], [-12381311349, 733922006, 31722528, 52358020, 42975903, -7256244], [-68458310631, 385676886, 24594458, -43900822, 146034091, -84523446], [7299781080, -1098865467, -17384710, 59744557, 4510978, -86176529], [-66676586654, 114678926, 70082604, -32285150, 50471166, -24430614], [-608438550936, 409709469, 62473839, 52091999, -19316281, 16523520], [-136937360764, -288618914, -45393562, -932782, -57178714, 26221426], [29300778806, 569722855, 107714535, 22535681, 38354397, -91070242], [253241164997, -149136628, 68925412, -44504800, -88708935, -1499242], [71244381635, 680455068, -15050543, 36681106, 7281210, -54821616], [37136109184, 213208472, 52884190, -41660038, 46276936, -126498758], [377688312307, -689773248, 47566296, 41541438, 27089269, 75892776], [322035449774, -110970758, 8926254, -25963656, -114920102, 57972104], [88923881046, 669089352, -106094866, 7839056, 125109758, -13178128], [101661010583, -1620347068, -27414768, -35310093, -27734679, 85658455], [458296530518, -128706408, -47258376, 48765372, -41943150, -17381810], [-153351597311, 1555902316, 54299477, 13900244, -60993820, 72668939], [497738259888, 479883170, -11215564, -22781498, 57453304, 36764073], [-14022733404, 768167356, -29761587, 30426027, 79077495, 115188405], [-257602452198, 331171264, -8135904, -7321190, -12774402, 128388096], [-155784157840, 1046714259, 19580807, -42030183, -18661153, -105108876], [150042419742, 340320630, -15233962, -81200406, 39674346, 30899719], [360120433263, 1270028025, -153009802, -1462177, -106626787, -37540471], [52107486608, 377711084, 39235664, 27062278, 72302606, -66218480], [444735724523, -830826032, 44941753, 47669138, 8170138, 55315797], [-178471195442, 11133202, 72625544, 28947018, -183061746, 107792268], [121808970138, -283722652, 23092416, 10645564, -29045652, -95579634], [-308922437273, -2275413336, 82557886, 33202238, 37138961, 12706303], [-85356043655, 211815819, -178195101, 1610629, -1854386, 86251022], [-464123551092, 458053889, -84459089, 11906345, -34107841, -36085690], [174202258266, 1403104848, -775688, -48732674, -132301004, 108765524], [-60353452637, 355724934, -177669377, 53085536, 99084342, -17433944], [695618471501, -41691794, 118416060, 11943306, 18179053, 34629900], [139423554101, 733499456, 22315328, -407742, 95979849, -111789805], [229507911903, -817177505, 57334085, 33184444, -102546052, 158155209], [-2232738693, 778800496, 17297341, 3272768, 133590956, -165102664], [-117210627910, -1902514530, 64863746, 28683342, 97381684, 8849066], [-257792706321, 927785567, 41942698, -83991503, -57703549, -5212713], [32384248634, 1481520779, -152084938, -13721110, -58603802, 63428454], [-448291012398, -449918426, -117587761, 19157585, 31019405, -124427053], [407458312537, 1141373783, -116722653, 10488196, 11274042, -20573392], [-197066391478, 97255830, 223045646, -36628854, -127141140, -63119967], [180136731436, 2141577722, 84232514, 15312682, -36972494, -81413188], [129720984693, 1694633408, 148790911, 16004680, -78816124, -4352214], [257809541052, -1247036251, -35087556, 57346725, -130559348, 32748171], [-812868644835, 771805962, -9264046, -16040604, 66551157, -78971438], [-40359428195, -1354000493, 44440662, 9098113, -165627299, 107337411], [73806626615, -1063379914, -42521045, -71595428, 19433574, 5828833], [-489285423698, -1126104294, 232893515, -50518701, -106420915, 122158106], [20428347363, -544072790, 24346562, -111788382, -88922739, -87264492], [340742669939, 1303536118, -59921788, -31937676, -5352597, 7294263], [256515546878, 1831981952, -95856728, -28458612, -2976556, -60010314], [-425695100392, 1419393447, -128036495, -6997239, -60493337, 36113251], [-469220981907, -1777051702, 96142584, 2001465, -58748745, 101652340], [300408487198, 750716256, 2302953, 46566711, 69034899, -60891903], [234418049841, -1282972628, 6973513, 87443324, 29388332, -231776873], [-331318325661, -1158892505, 131236, 31271433, -56798585, -6582097], [-431651313595, 1744324819, 152206305, 66163293, -92023812, 80238932], [-170027420658, -1304768236, -102368091, 20629915, 101774039, 148098681], [-151564524710, 44593350, 224149939, -53933425, -165659669, -70980839], [-341795343896, 943674140, 50733740, -3158462, 206835820, -11879730], [-289399030926, -1526482924, 93511156, -36885074, -5103602, -74440450], [272510791572, -1686905124, -138014138, -29106708, 162240208, -145469038], [542772164714, -1322306931, -1617159, 25537439, 35189721, -54651857], [489060496497, 861969524, 11680623, -53561388, -126520076, -99898914], [-295259491426, 122976688, -69370070, -75250958, -124397960, -37578548], [-730727841789, 1592822584, 69628769, 9350298, 235264000, -159471988], [-304758418343, 382330097, 55887750, 112541511, -260542215, 268582351], [-256252290442, -1277112908, 93889548, -59874004, 106852398, -351106368], [162849570397, 1086650636, 95461772, -126830806, 153117421, -78687023], [-225446807366, -2081310815, 88456594, 101668385, -124262914, 54646061], [803223761343, -106286264, -187459625, -35623838, -19236328, -22691723], [625601812299, 304241959, 105789784, 24898941, -201883187, -21452981], [-99474844755, -502995453, 127483120, -20644917, 25948139, -167008603], [-351585631908, 828499874, -416578669, -68365509, 71566643, 23832011], [-18099695962, -230009159, 125032019, 48682379, 121048359, -95786303], [-360712800086, -3535611633, 21227995, -135045967, -117842157, -8619925], [-511890370465, 3355898710, -44499842, -83950972, -27506969, 205954200], [354456054008, -2611006878, 50005108, 81971124, 87807994, -32719166], [306662679497, -2376899708, -70864424, -50728339, -80731237, 136058946], [-225219422877, 2873480011, 37138713, 18615330, 82180856, 112520236], [827125317318, 2519123789, 38249631, -14412405, -56873399, 176605488], [20041307396, -1017460542, 76258272, -81319498, -53482646, 74026822], [177836321802, 1411823443, -57330800, 104932479, 94062166, -190811733], [-328654939131, 762656153, 59556416, 10877881, -56164331, -73497860], [-382123294831, -804363662, -42061250, 3456752, -21732063, -115290612], [742668145289, 1767335535, -97321529, 52368540, -82544826, 332637328], [47661814884, -334338964, -123700348, -89776690, -162381818, 26152017], [23672777393, -897069768, 165003225, -128328962, 223090330, -418060414], [33683050117, -1680671410, 189535794, -90548176, -138341611, -236639338], [509089093607, 1215977800, 104272635, 79394226, 89858468, 361273376], [8599676646, -1449119332, -285096074, 4083044, -74606940, 76963944], [1216704950796, 213961253, -19062318, 127048809, 55530654, 224183359], [46710514794, 407247152, 280925960, -139587062, 166391360, -320771938], [557373596095, -3819956936, -122642623, -36486966, -12326836, -59860068], [231574010122, 1396401616, 307468122, -20125856, -178104320, 218905146], [269600532809, 2378074602, -91268498, -149529570, 7589771, 13213804], [77678400656, 795216655, 205604117, 52346509, 18449187, 359190599], [940819403925, 1245584299, -191087444, -5918123, -215764279, 268718922], [195513339441, 3023951724, 17812877, 4951808, -196322672, 197829941], [140151663589, -2914603577, 78931263, -91609922, 124262568, 52412466], [224307344140, 1336046790, -324989002, 60526716, -193647882, 58550470]];
    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_r();".
// 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_r(:prec:=6)
    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_r();".
// 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_r( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_546_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,8,sign)));
    Vf := Kernel([<5,R![-64956644533000, 740548691900, 15081987830, 17743227, -247811, -203, 1]>],Snew);
    return Vf;
end function;