
// Make newform 546.8.a.n in Magma, downloaded from the LMFDB on 19 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_n();".
// 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_n();".
// 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 := [-308009568384000, 1862570808000, 25221499020, -14548431, -309949, -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], [9427731423802360200, -53542834336954620, -319874939700201, 626570347621, 1548086629, -2024389], [89343994329715910400, -93918776326732980, -1059348303204831, 5325442304951, 2827655399, -27588299], [1854087064738915200, -8954762572396740, -92775859244187, 248055256927, 593013523, -1384243], [12374299269754128000, -1120675241488354020, -1872553860103833, 20223862688443, 14438167357, -83321227]];
    Rf_basisdens := [1, 1, 1236949910141400, 7421699460848400, 117804753346800, 3710849730424200];
    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], [-30, -1, 0, 0, 0, 0], [343, 0, 0, 0, 0, 0], [-1021, -3, -1, 0, 0, 0], [2197, 0, 0, 0, 0, 0], [-5768, 1, -2, -2, -1, 0], [-687, 31, 1, 1, -1, 3], [257, 3, -11, 4, -3, -2], [-9893, -21, -23, 2, 10, -7], [79703, 18, -13, -3, 7, -2], [95734, -47, 24, 29, -15, 1], [33597, -34, -69, -43, 1, 9], [121547, -679, -29, -4, -18, 27], [38068, -684, 32, -3, -58, 10], [4739, -2070, 57, 79, -59, 52], [80203, -3182, 47, 28, 103, -28], [-82956, -3853, -42, 78, 22, 79], [-525750, -1774, -194, 114, 150, -78], [-333605, -1800, -485, -391, -17, -23], [609883, 499, 29, 112, -100, -101], [188211, 3092, -433, 197, -27, -194], [-1605580, 3438, -188, -381, 172, 12], [-3661466, -8934, -200, 404, 4, 315], [-4397499, -942, -929, 201, -285, 424], [-4088994, -6532, 1224, 839, 40, 341], [-1002236, -14093, 196, -857, -207, 215], [-5469898, -488, -542, 21, 490, 139], [-1870362, 20071, -1560, 109, 795, -209], [-2461113, 11518, -599, -537, -781, 280], [-4749126, 25738, 42, 862, 1512, -1130], [5107500, -28397, 1536, -230, 26, 309], [5810425, -43927, 5759, 962, -2175, -1193], [-13914836, -43636, 936, 1032, -2146, 1980], [-11223579, 1812, 2119, -1064, 1693, -1156], [-219648, -49207, -7472, -416, 1280, 763], [2354318, 27403, -1256, 2592, -400, 1707], [1942506, -112494, -1226, 3202, -2164, -1222], [-29567436, -55467, 5152, -240, -2521, -3575], [8773616, -121854, 1482, 4467, 3188, 4071], [-8000079, -109852, -1743, 1114, 1253, 1447], [-11526818, -67372, -6528, 1748, 1908, -1588], [18631414, -57703, -394, -11295, -4300, 892], [17486730, 42626, -20936, -6282, 3102, 414], [39272191, 32292, 113, -2098, -1419, 3256], [102281462, 9785, 5542, -1449, 1889, 3115], [41261097, 3827, -3063, 22366, 2850, 2501], [60243561, -142304, 22877, -4757, -1973, -5866], [55671943, 175548, 18307, 7084, 167, 6362], [53391518, -204176, 26224, -16122, -12190, 8136], [830041, -221724, -2581, -17739, 5807, -14648], [136491423, 543116, 24215, 7691, 1211, 10583], [40111581, 110914, -33881, 11949, 23031, -8200], [174921950, -51113, 3106, 6810, 1132, 2615], [57352818, -210478, -38416, 9775, 2466, 8473], [31732841, -10024, -11875, -14512, -5669, 7297], [55752988, 465506, -1738, -15861, -11926, -11719], [144777404, 350726, -10548, -448, -6566, -19064], [150441849, 161598, -13937, 67, 27869, -2788], [176067917, 650870, -26029, 25798, -4597, -10198], [206859104, -101772, 24100, -2844, -7786, -18442], [212616278, 341586, 33036, -14256, -24214, -5509], [82233879, -260110, 10311, 48159, 31909, 15628], [-12986732, -225442, -21740, 42960, -7716, 48200], [111535418, -580354, -63456, 13764, 14124, -4906], [-64501735, 1288388, 44523, -4326, 5321, 14152], [474430262, -91470, -14030, -60402, -17800, 17444], [35066419, 298557, 78317, -2745, -66141, 18653], [179572356, 944702, 95344, -37433, 1348, -20977], [-57214921, -1732130, 65957, -13589, -2079, 37122], [-74535255, -890236, -188401, -16377, 109, -28859], [-272371209, -628348, 110823, -25199, -61009, 33193], [149853004, -2219504, -4292, -37366, 51788, -48960], [39118774, -573018, -78568, -22312, -11480, -19190], [-48717140, -3019572, -133384, -16858, 28786, -36974], [-456186311, -1247381, 70049, 104837, 14694, 12611], [68911094, 40292, -73120, 11436, 25746, 5298], [556809103, -2475654, 143213, -30897, 12897, -2086], [-374290987, 1781302, 87915, 72464, 30663, 706], [186654399, 602345, 13761, -62978, 69294, -74659], [-17632270, -1074855, 164062, -486, -83348, -12319], [-68810958, 574644, 153572, -14154, -21898, 91962], [735420091, -3045962, 29195, 191809, -52031, -26073], [786071348, -1499494, -46470, 91660, -66724, 43794], [582493950, -5234081, -154906, 53515, 5767, -26311], [-481882193, -400194, -328553, -34680, 49041, 51725], [281278867, 2428453, -91071, 55224, 79411, 30217], [1005013318, -572386, -78412, -162942, -47088, 67342], [120710605, 884367, 392823, 86281, 46797, -28664], [-70210324, 3667797, 146444, -53572, -8416, -114315], [-874560910, -3457001, 217774, -97070, -45696, 543], [-232949002, 3860795, -170918, -95854, -169429, 22703], [1564076840, 2815800, 240984, 91334, -19988, -13180], [342145498, 1365884, 401462, -162005, 46534, 68201], [1290592, -240776, -123188, 177568, -114930, 115070], [780084840, -7488190, 297752, 150364, 63654, 8150], [-929028034, 1182661, 153124, 139892, 100244, 16302], [-1160832734, -4155009, 262848, -157728, -186281, -139562], [-1116503744, -10648216, -262580, -37084, 45578, 143500], [-128117616, 6551099, -72598, 414843, 115049, 79583], [48972291, 29478, -493333, 52535, -38331, -26164], [719967935, -581136, -733567, -5552, -170779, -59480], [-1246382338, 4242539, -16126, -211684, 409432, -85449], [-2528485251, -2207526, 503679, 407897, -129197, 42518], [-947586593, -875318, 568007, -170611, -86435, 119492], [-3055321992, -873996, 748062, 483476, 25784, -151262], [-532090976, -7138930, 777224, 223591, 96154, 74762], [-3201390556, 606010, -145546, 8546, -346676, 33357], [-533886471, -16092751, -323603, -70802, -166271, 7402], [-3125567774, 623406, -500616, -45734, -19274, -192670], [411993450, -1576193, -410422, 337215, 442787, -149135], [695035114, -6224513, -651284, -430749, 197299, -55625], [-2805910333, 10180207, 480849, -32652, -168829, 288849], [2340151194, 12774773, 330086, -54322, -159630, -138803], [943420858, -10066187, 256562, -489364, 180850, -198823], [1214025397, -14529978, 414567, 591465, 98149, -77926], [1580935190, 1099255, -19142, 109300, -22130, 615961], [-370430042, -5690672, 640342, -241950, 249144, 133986], [-2078540446, -1147533, -338652, -35053, 320349, -105081], [3459608399, -6844142, 613879, 223010, -8197, 151], [2281974719, 4924250, -665387, -35663, 165991, 27722], [-834877889, -9572095, -131319, -255521, 625087, -420215], [-4101790748, -10526406, 832494, 168435, 374566, 12063], [4124563261, -14001265, 1224865, -408726, -40344, -220764], [2977066107, -3085982, 1054315, 485109, -636663, -25750], [-1491246587, 8586542, -261173, -683369, 88451, -368798], [1361168724, -9875160, -2409074, 66040, 454040, -318598], [-602055768, 6046122, 18832, 815306, -234300, 410238], [2809397384, 7892711, 395088, 336721, 373505, -19401], [2459517421, 1276244, 457723, -997025, -356415, 431790], [9350029658, 4030742, -1656482, -329636, -87968, -50878], [-1226454713, -21534138, 276503, 507647, -404019, 24259], [6975782377, -12203102, 919349, -287665, 460423, -214966], [-1288684339, -14079102, 419683, 305709, -320929, 427244], [-4881462794, 4077212, -1006944, -767686, -247588, -159919], [3034054567, 2828677, -1975319, -557574, -42158, -459413], [-3725873529, -9048533, -3668967, -287091, 270615, 30784], [3900760699, -15225785, 290443, -1152729, -162503, 216649], [-867890140, 35566452, -1374938, -360523, -623944, -593427], [6561623943, -12031350, -1949215, -325085, 271863, 561864], [638264492, 4288661, -642872, 1657846, 648340, -286471], [4559317205, -4252592, -1988841, -469386, 33767, 798632], [5854754388, 44783988, 1452220, 113894, -457826, -28392], [4363419569, -29650311, 1112421, 1010906, -386718, 92508], [8072959712, -52968265, 1476882, -717228, -49842, -82639], [5894492847, 5314622, -1412369, 768502, -293909, -477666], [5114772149, 23795876, -1238621, -1044365, 211633, -345532], [4115953050, 26878750, -87392, 1639159, -271862, 422037], [11683338622, -10152716, 2848922, -408192, 172494, 428718], [-1669413883, 38973246, 2068413, 1396417, 445243, -80475], [-3415806260, -39594016, 3923590, 2399178, -478028, -80458], [-2475561304, -20620679, -1355402, 591276, -1133093, 865536], [-4502914852, -8984885, -629792, 744331, 330457, -220805], [5090179464, -893388, -4029744, -1046162, 1124276, -578294], [13217671903, 9999138, -486729, -1626401, -750071, 66950], [12156251021, -32959711, -3246607, 777708, 536361, -676298], [3147344286, 9332334, -1794298, -952776, -115852, -740652], [3382485622, 9980800, 1957992, -930712, 411434, -1384031], [14926951600, -14235760, 1051198, -1506448, 410408, 460468], [-12675104992, -34781938, 467734, -277784, -735048, 180737], [6414977225, 17836173, -300883, -607740, -427998, 940880], [-8922459057, -15341380, 2553849, -1414283, 896357, 484498], [-15657158102, 7132179, -5224350, -323060, 21058, 116999], [1324184266, 14037664, -1967562, 692530, -1059306, -523704], [7168616433, -27422145, 5802103, -22060, 545709, -479275], [14498338046, 23712375, 1707930, 2039520, -1155073, 938565], [5185971300, 87222082, -2944300, -1752302, -891092, -444424], [12403850448, -42244804, -3565670, 72244, 1146590, -122318], [2544540948, 41673536, 127234, -1566858, -196416, 30084], [-23022977180, 39410288, -3584522, 2188539, -195828, 301765], [10873129533, -16332739, 2912729, -2491924, -1066246, 1645336], [-924074880, -6021952, 3047082, 2622838, -175902, 151754], [-18206490835, 37957704, 3086017, 2272106, -780061, 1299643], [83145498, 22033208, 3238152, 262820, -81850, 1618188], [25443575704, -10667235, 4729920, -829793, 2063395, -880549], [18829071614, 74570486, 4617836, 3810259, -1419850, 1260291], [2180054172, 69322602, 2290704, 145948, -655476, 1134762], [12710892045, 46557824, -1858769, -754398, -45295, -3280134], [9043359736, 21071124, -1410496, 2029820, -1616876, 2361598], [-15864997368, 42441737, 5393434, -1859174, 2089802, -737303], [-5101212390, 128101563, -2288190, -922154, 1013718, 1479831], [-4378581006, 45473864, -4138874, -1695306, -719146, 1794532], [-9343143514, 14412464, -7659208, 1905986, -2900398, -213952], [-13062566084, 45732918, 3187238, 1843360, -1273502, 2109893], [16018490925, -15435932, -8396227, -334193, 3130107, -1252061], [4159611616, 20532300, -3825382, -5694519, 1128464, -311187], [-19952113621, -133257140, 4577873, 1169777, -4268317, 1463026], [-13140299819, -62465349, -1796971, -1277573, -1872193, -906351], [11103942260, -96846764, 9868618, 3994830, 2130464, -336144], [17874159656, 73050725, 7889020, -663106, 465407, 418891], [-4857277432, -9370642, -5521762, -2079318, -1270880, -911256], [-6980905369, -78996083, -4106013, -1557132, -94360, -4237932], [-429903971, -21477474, -1348899, -811301, 2238139, -1839346], [419262748, 27957379, -3745406, -2508662, 1041026, 2393094], [-19969337989, -115112166, -10225789, -5762164, 1422409, -446309], [34347809970, 35698833, -2381280, 30622, -805687, -151816], [-480146190, -25946990, -8553264, -1628316, 3366520, 721758], [-22997280171, -64352970, 7915395, -430387, -3770377, 534628], [12252388650, -41148566, -1034652, -3072352, 2716624, -727569], [-11073514058, 7210024, 4779766, 4327496, 1676014, -1199794], [41612777237, 93305220, 6615639, 1988054, -5104011, -558012], [19331618144, 106834255, -4209016, -2780815, 2807249, -2277143], [-35174687991, 42364614, -8091745, -3641031, 1500743, 2118864], [38175702324, 91040708, -3919430, -1083226, -2112980, -2534002], [28513816130, -213490672, -1196582, 1817587, -1420902, -195682], [-31174615950, 92788366, 14238780, 2095445, 1014832, -8441], [-24691401089, -56858726, 12769099, 246831, -296081, -161792], [-17764560425, -110935168, -1741673, -3935040, 2622159, -7139659], [18242760887, -51314901, -2616211, 6256604, -1917161, 762939], [3126901230, -164512212, 5508506, 6931618, 1377856, 1530574], [10517936777, -109244829, -9375061, -1141727, 1331913, 1031687], [-36233206662, 38326344, 5243084, -3266751, 2561746, 1026859], [-41961651050, 198538586, 1207086, 1520258, 572250, 1226012], [-35408584131, -45739788, 1576177, -4554082, 469953, -4022016], [3713192536, 184161001, -219252, 8347226, -1179577, 2893061], [-55820018157, 114097853, -2695059, 2612170, -264078, 4146659], [6173191935, 71275848, -7548805, 133101, 2019467, -98964], [-32557862288, 214932457, 13807942, -3592682, -1273225, 4125180], [19444602939, 78642036, -10743445, -2781489, -3252545, -3557225], [-44432877417, 152576780, -1019207, 7233420, 1315475, 2153194], [-47953546311, 24314528, 8713359, 5521195, -5929527, 6461354], [39197689700, 50385508, 23084540, 5701836, 1387258, 348374], [56774855751, 220861313, -5483867, 4488148, 3820939, -2033391], [-31201659872, -131735452, -4594424, -1326118, 10363364, -7776032], [5465782582, 102842757, -1382366, 3836352, -2149848, 1147791], [-15098484293, 65277994, -5424999, -2570009, 2532877, -4419984], [-84774667116, -60907335, -7162254, 4526272, -1464901, -391226], [28276212989, 213978556, -1348103, -3192116, -667761, 1291925], [-81310864580, -42616229, -7762380, 2133569, 1492389, -2178485], [9500291061, -5822861, 15903681, -1330140, 3550140, 2191496], [-6958435654, 17577240, 22079060, 6336968, -165928, 1137336], [-2419794530, 139889234, 14564346, 1713222, 4711202, 1546392], [24739592722, 209184919, 5469114, 12006632, -1437930, -1909175], [-76610991598, 144128982, -3958824, 3173576, -4753164, 3324506], [-35167135000, 175470438, -7013628, -4254900, 1905636, 2784744], [-41525356742, 192777289, -12247130, 6372628, -1608547, 4692203], [-26983294304, -237309025, -27526602, -1876041, -1751851, 2806125], [58783733395, 137440440, 727517, -461698, -4748469, 4250120], [9704958731, -126240642, -3703813, -5629448, -7303753, 2454085], [12938523158, 110844864, -3431098, -4496860, -727484, -11197572], [63341237815, -32674820, 7094611, 5323187, 9106711, -2984461], [-21197348806, -160253984, -4798138, 9216910, -12714186, 7276896], [-18979756706, 90110367, 696430, -6723367, -8225161, 1235717], [-56716708118, -63811412, -9950660, -1011176, 7151406, -2416330], [-72680440506, -209919458, -1568736, -8129896, 3087304, 4987675], [-136597620322, 419070876, 7119350, -4259040, 2197824, -1111614], [-30027932541, 15939540, -19828457, -15221783, -6180235, -1243768], [45101618620, 2018040, 2959140, 1060955, 7462796, -2834824], [-12469447730, 42891166, -1424606, -3170852, -7315962, -2069362], [16723827007, 17968681, 19421827, 5231726, 1101007, 7593480], [-52224126592, -115645331, -27050054, -12327707, 413635, 163801], [22162625085, 245523154, 19956451, -3519747, -8829145, 11028975], [62304603319, -273621896, -27870977, 3927351, -2289309, 8702137], [-4838888006, 285597624, 2060912, 11813276, 1097266, -1773626], [-74640312646, 86005908, 2522172, 12979915, 4032832, -5496071], [102706414169, -39225265, 16078213, -5783136, -9622388, 6664822], [-16191586225, 475594104, -15622067, 6898151, 9897201, -5032550], [-69316444750, 203267068, 16545110, -3423352, -4796482, 5466040], [-39524403874, 203055658, 23063728, 6918105, -8772800, 11246587], [-152738960091, -159756697, 7967815, 4445694, 2251254, -5642979], [-37004863909, 285151710, -20026009, -1274739, 3903985, 7757584], [-30977265725, -250940248, -23461621, -7688500, 7897803, -4610913], [-28655036915, -199462878, -30288941, -14317257, -4813439, -2187000], [-212975671248, 13617839, 9349922, -6100078, -8097630, -2821541], [17976765903, -110798646, -52257675, 8210207, 5485159, -5059129], [-24616433798, 395708858, -6533282, -13346538, -3912398, -8798866], [48060180751, -323764338, -9812103, 6021644, 5415383, -4504282], [29044942676, -38711534, -13342138, -12093184, -4235552, 8873261], [104121969494, -599530864, -9547118, 1084114, -10562078, 12589388], [197670755404, -389168732, 26356630, -9377096, -5133580, 1295274], [-172554019510, 77934732, 22271012, -7142138, 5558028, -417982], [40828272432, -408228898, 20054412, 22553166, -10324784, 935764], [33696946456, -96067967, -15267914, 18162673, 3134499, 11969963], [20993284423, 298489114, 20169259, -9214583, 4126329, 8650526], [4657623100, 321647558, 38500178, 4548256, -1958290, 13353212], [40304875924, 582489576, 17057372, -1157730, 15710784, -8687266], [131940194183, -792182053, 17940587, 15397028, -3831794, -5457370], [108805036966, 216378273, -17148576, 1134457, -15152495, 7215365], [39150313580, -401365358, 16635178, -7429234, -2538126, 8941622], [-6399555842, -566836760, 18850282, -1133266, 43786, 9999090], [64812081938, -174372344, -15455030, 13696456, 1865712, -697224], [87306668096, -113918773, -71143016, 6321112, -589052, -11439541], [-61984013096, -224478256, 144, 387870, -30801194, 10322500], [3260675951, 243671140, -18829355, -2006631, -3350041, 1070316], [59559421506, 190352633, -14405234, -1585430, 21487010, -17860643], [133793831325, 660060180, 74555057, 22382592, -10623077, 1274471], [-12651067219, 161321781, -30268737, -28644723, 3767457, 6474141], [80712984103, 8032650, 7150465, 19995494, -3354101, -5417478], [8219419834, -233508956, -10901278, -22986852, 3552276, -15755514], [46376669170, -229087757, -18505368, 2214606, 18056059, -14253308], [-32150367363, -225375427, -37914085, 5366702, -5698318, 11717565], [106323735218, -551479523, -15034314, -2037954, -17669824, 15201479], [329993471653, 173476729, 17327059, 4095508, -20992723, 4274115], [9647339156, 39290932, -56367020, 4432409, 16135850, -10136600], [-40135624827, 748790542, -6113469, -16086239, 2385351, 8298064], [-77485232686, -164805740, -49066036, 9059773, 34905740, -6100551], [-27387397376, 307028048, -19898480, 31120982, -7026808, -6548], [49468116298, 178250302, -1434292, -2669591, -1169306, 14543989], [111609391658, 499040461, 39661094, -10746112, -16673804, -7993507], [-156761917257, 195259525, 14771975, 9229915, 1732789, 425555], [-156812386998, 54118742, 73563424, -11612094, -24574806, 17645802], [203828524853, -270105024, -11456153, -7818130, 3203171, 17162202], [188557337069, 670756192, -30856039, -22905721, -18299947, 9721918], [-170491842119, -716050824, 2727369, -6816550, 29299751, -3230723], [199449642457, -325240141, -49759863, -4583022, -1697098, 17199195], [-265056409796, -663999190, -5190198, -2198386, -4484280, 5459750], [260174247700, 36667726, -24034192, -24004491, 12637010, -17110341], [-198866176722, -36973923, 4024600, -3626982, -20316672, 14131099], [144298886423, 479663446, 28772159, 25383515, 25681027, -2816173], [-140259902185, -280783982, -81219531, 7001235, 4040049, -12648884], [-33899216902, -60272116, -35221366, 1479742, 15092000, -4203476], [272111902759, -64180192, 10897577, 18421222, -13509833, -1499162], [26543063200, 45931698, 7121710, -16681018, 2194042, -4869764], [-3278612741, -1134777223, 20426835, 20432546, -321306, 15057719], [-114849996041, 763497422, -42268089, 11358735, -8052113, -20493139], [-99034759268, 141535230, 57924218, 42652282, -9180748, 8385000], [-52070472788, 310809008, -3152300, -34498359, 19672200, -3311954], [240165708851, 254672412, -4705661, 33393355, -7711275, 11331315], [-331812150083, -40226015, 25657727, 40122944, -2156672, 3461441], [330370553657, 449834482, 2812091, -12413951, -36408667, 15086502], [-195751060330, -138140726, 36205794, -24681620, -8774404, -13238764], [271072645116, -22787078, 65755786, -4197856, 22067584, 2910862], [-43013597372, -191042144, 80596582, 18882241, -13622356, -19817579], [-323090180236, -1229618879, 2642796, -13956520, -28535540, -7157181], [287718776319, 506409133, -95619979, -27219276, 13537807, -20040683], [-349367299788, -1325731604, 5163626, -11454290, -7844156, 10189106], [188145659594, 95715808, -79193802, 4830614, 47686480, -28484172], [-141488059115, 237770331, 77927253, 6700615, -892301, -19375165], [116692369010, 55224017, 32609298, 8562353, -4999020, 25648892], [-145984432522, 602254331, 27793088, -24535497, 7670409, 11769183], [-150220703526, 302422105, 10040444, -61299617, -8502767, -16715143], [-115153320841, -279587471, 28829413, -8564564, -33760704, -20915633], [-283299402294, 921821512, -14569782, 7232076, 3511630, 23032182], [-484542283396, 88781114, -80784196, -12371867, -9632272, 2200394], [93086792000, -1609547640, -30263060, -10630818, -8349136, -5749576], [-271850100026, 1273884230, 77542486, -1795349, -13852162, 18883318], [-457736480022, -268542535, -104742556, 4010545, 23131129, -4701591], [-41618873755, 1129638354, 53468139, 7035975, -6539161, -23377391], [107152176930, 402677980, -54832768, 42420250, 1666294, -21184012], [-403490142862, -141781721, 1488034, 32211941, -41251509, 35395979], [-35000946700, 1603276, 65891830, 21028818, -8721448, -10290234], [-227938109752, 227058538, -28695490, 50564708, -6771656, -505020], [34518820247, 1258483077, -76535495, -42782881, 3377063, -6170872], [54262931256, 117170502, -89781072, -2045016, 25927378, -15582652], [-343286839847, -115141482, -106790229, -2238898, -40402717, -1172784], [-81697874700, 916233252, -23886472, 70535607, 10982746, -7664129], [-75132035708, 1718307873, -7323218, 41125760, -14904526, 4559267], [-409019596718, -1240268970, -31047770, -47574066, -5392742, -9828864], [-387009929550, 1430653388, -57058202, -15299903, 15817912, 6954364], [-97906377504, -325564954, -11706694, -41874217, 48554534, -5208761], [437901592365, -121876354, 79483125, 8648241, 17781823, 14748244], [-129565076248, 928334326, 20136206, -26713008, 21360838, -11870026], [-310991537353, 26365100, -22351367, -31356996, 33099709, 12301504], [-45681652806, -300156328, -45303910, 24585206, 40765374, -8569844], [521620613354, -235282120, 168989084, -3911496, 16516132, -9912864], [-794665371076, 26602813, 2633666, 14714384, 25831243, -32264368], [-8376885794, 1547345995, 44736506, 34733170, -44049761, 68489617], [-8175231662, -144726942, -87343110, 47202497, 27310844, -20106608], [84484727648, 1185013944, -35212818, -42740742, 941528, 7522580], [-64290097725, 690376740, -12659237, -75486051, 61649549, -20341555], [-57931666000, 78895791, 28682522, -68470903, -14015527, 7176879], [24569524034, -1698680571, 93030664, 30745046, -40047379, -8492086], [-54378111379, -1181795009, 100016153, 13397718, 27754269, -2830304], [434366328993, 198488996, -107757035, 914037, 28317533, -34305239], [110481908440, -659479474, -46588660, 48746224, -22674562, 31276826], [-362131870785, -451840506, -62895295, 15318657, 45534827, 7284672], [-551398396586, 1589558233, 85827548, -33254696, -1345352, 22991910], [134409408130, 891265575, 115769706, -22915772, -39704318, -21281077], [-158622873735, 186898279, 43151891, 45968081, -3839919, 18814431], [459115456226, -422593204, -3122282, 5557341, -47367680, 36831497], [122939743200, 1698095392, 70448124, -10848540, 39470092, -45735210], [402488379315, 628085628, -48066949, -67513619, -38422677, 31131777], [-811486454751, 253476135, 36871543, 5772216, -10639816, 18824315], [-141122126138, -609716319, -49330922, -83792743, 17605301, -7353043], [-515480583189, -1249764080, 45656017, 26022095, -63570839, 3613186], [274319574417, 645952898, -58455939, 27172064, -70905713, 9994242], [263390309330, 2829995135, -91208702, -15971037, -18764828, -60188904], [-252093898890, 2304151323, 53268428, 12445613, -27511089, 21162419], [-425650027760, -2026888327, -13366474, -25580646, 28285955, -7671704], [-638509580510, 345621604, -20916728, -79212350, -18820644, -34659886], [-366196771582, -884936074, 169323648, 111881540, 33588714, -7616645], [-122811832729, 3347675791, 32076533, 13220454, -23180601, 27148555], [238340213930, -980075873, -31942070, -3005540, 19649794, 19127161], [295750989129, 940518014, 27063295, 11671150, -24873017, -11527040], [376344183573, 1953992894, 77881589, 7209353, -15788937, 48911038], [-82121112768, -1639567227, -120416220, -42518164, 32457271, -46147833], [316052716458, -804454409, 84441090, 61479348, -28639262, -29568963], [-229084881234, 541993531, 27937280, -79913802, 74717540, 27536209], [714755922930, 261763580, 74579910, 18754282, 40082280, -10194544], [-115907632330, 556717246, 23679206, -28560962, 7569254, -33737452], [154558277632, 845488532, -51665842, -60743960, -16986262, -21043372], [128040270320, -1395029070, 139393966, 70118008, -3988044, 10116157], [1008653844867, -250829524, -18746521, 59633541, -35453477, -15549127], [-664401017408, -1570032340, -51255828, -1814376, 28587830, -74414322], [-165864441845, -1304977680, 102104747, 51656287, 89672581, -11210391], [-178865185003, -616490730, -198896673, -32114089, -2791007, -48087532], [477461264704, -761576986, -13036032, 50360734, 41682646, 35856586], [-152108647030, -1590176423, -139247872, 25015612, -45438367, 39760492], [171827657415, -1784076007, 108990855, 66880, 4692366, 8225849], [245968459829, 1815977734, 83427055, 53183368, 11658237, 45786132], [-3173231571, 1391590700, -160770653, -21070107, 14491995, -31694364], [-335383608309, -1220203470, 102193989, -7791077, -46960927, 33363244], [92864487696, 1513522437, -189171296, -36520004, -26232772, -43449259], [-892182176358, -1353242272, -62073412, 8061048, 112905496, -47501111], [-694457993908, -1469062718, -12701438, -4241758, -44406904, -14920047], [924244302038, -388571737, -78295850, -33154623, 3275723, 55034857], [-62541997206, -1522398080, 167964212, 68771182, -5124638, 42608666], [-187502288025, 1238748281, -108145243, -114915380, 49081911, 28784513], [-74606087451, -1234041257, 63794845, 135732221, -42589757, 6024733], [-21659434560, -857378812, 73136240, -143216597, -50182782, -224516], [-975764564140, -1618299820, -87232454, 6171694, -47031482, 19606496], [-1018027502041, -1978557725, -162398347, -86756960, -44508346, -22366019], [-41687579685, -2720517072, -5830629, -45339316, -33078053, 25946595], [-430869131926, 891667553, -32322, -14049399, -68307087, -27563467], [-296695534643, 459773363, 4460599, 54923393, -39318271, 68457247], [-1012745422570, -1342570528, 152960032, 43129503, -4034156, 25956339], [-345913424821, 1737546806, 108686739, 62170455, -65929261, 110862257], [-580069101974, 906626141, 22597130, -51759203, -4643251, -77715043], [79141940943, -12667424, -194411739, 87002343, 67687899, -17616039], [-406075624318, 515916956, 105832746, -23103510, -34092418, -81556090], [-246054003957, 966974069, -70088839, -134754116, 74805060, -38873677], [22360967236, -1640000148, 29174294, 89708880, 33047748, 35797010], [-848717658525, -880387980, 57819387, 16961087, -16566023, -106616207], [-267541033286, 4040760828, -43960898, -105506004, -47265162, 53151448], [1097174294470, 1709667281, -70775516, -6619909, -2380135, -6577667], [-581065265262, 1139814338, -202645376, 85497892, 58622698, -60160969], [-121480638149, 1545833182, -207582645, 99212674, 53475555, -57109375], [-28256777675, -445224194, -176197661, 125005044, 62227443, 938630], [-181885713901, -1828440705, 195931443, -3439863, 66420141, 31655913], [528319841658, -3694812212, 191115930, 96102922, 89745428, -10890454]];
    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_n();".
// 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_n(: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_n();".
// 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_n( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_546_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,8,sign)));
    Vf := Kernel([<5,R![-341044841259000, -343324745100, 24869553210, -22096449, -296299, 181, 1]>],Snew);
    return Vf;
end function;