
// Make newform 546.8.a.k in Magma, downloaded from the LMFDB on 25 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_k();".
// 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_k();".
// 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 := [44264019648, -256427072, -20997404, -148556, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0], [-17355924152, 834162828, 9590106, 4229, -67], [41732843296, -221698300, -7789168, -7461, 57], [531906698624, -7627377340, -132645092, -74621, 917], [934627614848, -13688812132, -280855608, -212403, 2039]];
    Rf_basisdens := [1, 58323928, 8972912, 116647856, 116647856];
    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], [102, -1, 0, 0, 0], [-343, 0, 0, 0, 0], [192, -4, 2, 1, 0], [2197, 0, 0, 0, 0], [1580, -40, 4, -3, -4], [12029, 24, 4, 1, -15], [24564, 55, -6, -8, 14], [-3499, 155, 23, 58, -28], [-35516, -144, 59, -58, 47], [-10905, -555, -56, 42, 71], [-47569, 333, -58, -123, -137], [-193921, -961, -35, 30, -194], [-76626, -608, -297, 14, 9], [-284, -366, -191, -496, 535], [411286, 966, 540, 886, -722], [-143953, -4426, 435, -311, -300], [539366, -2696, 884, -898, 1390], [1478771, -517, -422, 553, -155], [1745255, -5253, -581, 1214, 90], [930036, -3940, 179, 512, -1749], [3552620, 4466, -833, -754, 3335], [937899, 5541, -2715, -1079, 2078], [3132448, 20806, -2741, -684, -2279], [480229, 15053, 5648, -3131, 1855], [-3055691, 343, -1960, 2972, -1609], [-3036517, -14939, 2684, 4869, -4549], [5352721, 26491, 3822, -398, -6325], [-1699952, -26788, -235, -6742, -5209], [2409462, 15590, -6240, -7072, 7842], [-9738007, 31326, 1483, -6745, 4116], [-520007, 17818, -5257, 257, 8154], [-1949312, -70398, 72, -6598, -6080], [-5444872, 110822, 7404, 9024, -28630], [5302051, 90564, 14003, 5895, -20250], [-4105425, -44774, 525, 18597, 11982], [-20288194, 36642, -9944, -31252, 27462], [19462279, 22065, 11499, 21890, -15000], [-8035069, 24947, 15966, 6025, -25345], [13171841, 29225, -23259, 17949, 10994], [-32655582, -108252, 16280, 16008, -6348], [56972116, 156537, 12637, -10164, 26637], [-19603396, -73170, -2640, -37432, 39886], [37179700, -72076, 12134, -27814, -19020], [29481125, -287001, 38000, -14790, -18629], [19308617, -58791, -28699, 51266, -50332], [79446968, -34352, -34155, -32384, -28735], [156986868, -325902, -69286, -38608, -13222], [69886910, 453906, 6822, 34202, 40818], [82023256, -394440, -19821, 4220, -4031], [143356545, -256103, -69350, -16149, 40875], [31912940, -630354, 9591, -62716, 111433], [149900207, 477256, -11723, 7965, 44780], [87101045, 786889, -13872, 50327, 16279], [128278687, 117145, -13611, -42251, -53848], [133971877, -330117, 65856, -47159, -131681], [-66123752, 362924, 34468, -87586, -78856], [125346596, -25412, -89903, 129902, 19251], [78033606, 757696, -10908, -171084, 111952], [133373334, 346504, 97942, 163892, 108780], [10690507, 1158795, 7753, 6875, -121414], [-62307146, 826336, 62899, 97338, -229471], [716733872, -87430, -59104, 98608, 7560], [291592292, 636048, -51146, -35538, 360392], [287253140, 509586, -99642, -244520, -145304], [23129016, 862312, -60138, 89406, -125482], [154658027, 116236, 268880, -189123, -345187], [431444603, -805513, 309786, -160563, 183841], [48767326, 2211812, -109405, 72914, 192971], [738585475, -2140121, -117936, -16475, -15235], [392358795, -1151637, 107570, 556501, -364355], [147465348, 772348, -311414, -496688, 57422], [-105075744, 1408780, -272810, -185646, 526696], [583050398, -3425216, -116204, -254768, 400930], [563001483, -2857857, -9994, -345254, 209011], [888619144, -2664828, 214878, 45736, -237052], [451843490, 3027772, 72527, -177522, -583205], [314459006, -1583372, -109326, -414628, 168086], [-4692131, 3821865, -280177, 390506, -132632], [-847148951, -3890248, 230663, 306907, -129448], [24546332, -1189520, 396580, 297632, 404622], [641231629, -6343647, 548804, -274699, -211275], [-1320010776, 1039042, 536790, 578860, -133208], [480792387, -3147787, -183410, 39830, 150643], [-118793505, 4066399, -562603, -514107, 103684], [725520771, 3331752, 21687, 906951, -626004], [1419265500, 3463808, -171032, 299722, 92626], [-591613960, 5288809, -808637, 42598, 221225], [-473466219, 28034, 241233, 228165, -594698], [913357031, 7494456, -41715, -333619, -301388], [-177491771, 2630511, 505495, 697382, -517010], [-1221972256, 551860, -865174, -78368, 765114], [391212025, -185629, -1000040, -1383489, 1402005], [-608061554, -404508, 469170, 103676, -799064], [-1642399942, 3077414, 1142838, 123440, 330820], [1482124632, -805997, 1582998, 745474, -1465376], [60122718, 2967422, 1458416, -820483, 993526], [-621834784, -5983754, 453764, -31334, 856108], [759007041, 2276935, 1890752, 476122, 265717], [-411785554, -2213560, 170143, 951646, -2373107], [-830588572, 4592232, -568668, 273694, 1791194], [-2464208105, 5250168, -706905, 1061557, -151498], [1137623058, -2031876, -1555399, 1728118, -1237183], [-1395789306, -761456, 240933, -505786, 958955], [-1694329356, -4542712, 1659814, -591752, 1028692], [-155809506, -12003170, 567909, -47454, 1949243], [-605095911, 15045469, -33791, 527481, 1738444], [609608800, 5714625, -905000, 828580, 840080], [-2645050100, -12577566, -628040, 705240, -297490], [-1175298981, 177069, -1569950, -1070378, -2499529], [-1940071175, -5223889, -271624, 2145762, -3518627], [3461202275, 961130, -1838149, -48593, 217784], [-436882627, -2870622, -181069, -2361683, -160052], [2123725521, -15564162, -1387035, 444957, -298250], [1141898538, 14380634, 1689313, -1374004, -368795], [-3144118587, -11025800, 555493, -909943, 854190], [-926809870, -3196144, 693336, -610896, -258058], [1929545933, -5610503, 2967324, -1526676, -1917303], [6348817485, -2205821, 1748621, -32575, -1682602], [1725061434, 15795082, 1669977, 2541332, -155063], [-883177661, 726568, -649540, 2576333, -4630031], [1708981303, -2069235, -1717894, -1494185, -1152133], [3690443084, -11442828, -404292, 1793567, -2111966], [3515853672, -13340514, -2503569, -853880, 5060127], [7127806890, 9148584, -2445245, -2734718, 2372175], [7349076764, -19512520, 1659674, -1352444, 1334724], [-2947193970, 18739668, 305984, -1862786, 1607462], [891614465, 1435355, -4154230, 1916472, 2757661], [-3544489498, -21805576, 723319, 3385752, 704787], [-3191052542, 29763046, 1394650, -665400, 97860], [237890009, -14575899, 1848102, -2232491, -4166677], [-2399792196, 3796238, -936999, -5798000, 449905], [-6290772636, 11487558, 4051475, 3057940, 1472537], [-184664363, 1671709, 6496241, 2688255, -1770700], [-2515212697, 14412591, 5124629, -4281728, -3215736], [-1020807412, 13675925, 1362895, -445846, 1710161], [-3357629205, 11871798, 1705360, 2193003, 590859], [-4729095315, 18057659, -4479610, 3462959, 289201], [-3302367704, -11601820, -6791663, -3948506, 3003003], [-11971869147, -13800794, -1357985, 1747269, 1064336], [5000593552, -33008116, -1403594, -2826894, 3706296], [-2374904052, 19971190, -3213462, 1716258, 6235314], [5382001416, 57764032, -886584, 2602497, -8605274], [-4306945611, 13377400, -3951277, -425073, 4897042], [-1076259960, -32054976, 1495304, -7636852, 71808], [637036456, 15077958, 3699709, -899878, -7530589], [875587993, 31232417, -4946212, -5990197, 841167], [2396129574, -25095438, 5951086, 3496182, -2031832], [-7075329585, 29996907, 2916754, -4335713, 5581893], [4966885192, 10521648, 4124588, 8994016, -2280142], [-8178349572, -54803564, -3576370, 8552301, -1774146], [-3530164335, 58180315, 1132560, -6137584, 5865023], [5478517994, 5916662, -6297616, -1726742, -1869686], [2376414944, 15782306, -2129303, -3863352, 1744545], [-8374034292, -43844143, 2262114, 1141216, 1738182], [-14062348148, 2074668, -7559264, 3679338, -6140224], [-3156315575, -26865837, -4799657, -2377767, -10184214], [-13373312434, 1688506, -14310952, -4616302, 10858056], [-17812186727, -30952663, -5449941, -146563, -652726], [6173676860, 19131464, 2893822, -1485591, -4804696], [-10463033870, 5204714, 1619153, -3748162, -2995943], [4195891319, 48268106, -7549949, -5638749, -5448342], [3507347656, 46551056, 4704834, -238576, 6803830], [5757364155, -31406006, 18403799, -4314901, 11692796], [118268411, 48808505, 4084755, 109644, 1144560], [8401848872, 34072374, -901958, -533100, -6000814], [4655011168, 62059282, -1880662, 6513158, 10327796], [627047874, 47515330, -4603590, 1296422, 12570862], [3301171181, -19032093, -8177680, 12869943, -14868197], [-12532106260, 71880932, 1007598, 8142189, -10246776], [-1042355812, 8707918, -7455656, -453782, -1966242], [-8200295223, -17044829, 9815569, 7321871, 13765510], [-16316441826, 42166674, -6185292, -8126874, 7030476], [1123842869, 59268807, 1507880, 11313834, -11429829], [-27708945621, 5855183, 8708674, 14651149, -18504953], [9942377794, 12662916, 16112470, 5479698, -5243844], [8317110642, -43617548, 19861468, 10194850, -8496964], [-22367957158, 86169902, 13233962, 8356798, 6259988], [-7716129987, 47815094, -16892395, -15134225, 13186420], [-1017758421, -98475974, 2997829, -14662601, 14999776], [-12369609356, -74965308, -625342, -151124, 10506554], [-5365702962, 115682090, -9430094, 15813018, -19654850], [-1754103291, 43637827, 3306111, -12911861, 14561666], [-19751286011, 63383391, -18329354, 859897, 5166479], [-11694905579, 122515023, -9771406, -6131341, 7820693], [-8507701414, 99208356, 22527053, 691980, -14513595], [-14078086689, -2140514, 328748, -12460341, 12465635], [-21988648234, -34848302, 7858638, -20895126, 17230814], [23072822785, 128940395, 6078923, 18761396, -22432766], [-18104697062, 54033548, 12697570, 14805706, -13488506], [43425915564, 98337436, -8484750, 2111401, -6769852], [-14392529724, -3112558, 16462829, 18793952, 13161001], [16455941460, 29056129, -15962640, -11818678, 27691350], [24914669029, -133717727, 3982855, 18356383, -9150436], [-20711440088, -68630056, 1291732, 5624433, 7999120], [-51548581008, 1416468, -4152866, 1802318, -11990948], [-31742861932, -140239622, 9310331, 23159028, -31079383], [22904424919, 101722809, 22985957, 12125013, -30900238], [-27369083526, 171129682, 3880278, 14283098, -10042008], [-16096402808, -157063754, 1411966, 9879620, -26586012], [-13426589097, -84899579, 16948796, 4706366, 11435437], [38981376568, 21185330, 18064495, -20690300, 24505761], [-46056001092, -62189880, 11398024, -19183556, -6874658], [-18075789934, -30345474, -28763839, 4248004, 7973799], [-36695939093, -22883363, -11746144, -16415317, 4269029], [4433940386, 81044066, -18973177, 14351832, -19658551], [-72681852669, 68427195, 20067201, 11451967, -9413704], [-8957852231, -244078368, 3486625, 12855517, -15391084], [50007113746, -328488492, -4531644, -10857224, -4264098], [-50712498923, 236733292, 11598916, 7178571, 12317643], [-32269664413, 71148977, -4966652, -24040303, 12468117], [33466231576, -49174658, -22826434, -10450264, 42254726], [28370035286, -14533880, 9153930, 8397002, 657708], [-21177755837, -68015555, 7519881, 10309654, 28154938], [30665090107, 147682103, 14647581, 29375224, -34820812], [-75192419154, 7304500, 12841181, 22212476, 8301747], [-48342022576, 270760964, -22635760, 6444241, 4747020], [-45726136439, 71397001, -41362026, -14929453, 37351799], [-29861345498, -254160528, 13662826, -28564438, 33509142], [-61247260186, 29792776, -38540237, -20185652, -1107137], [30908787854, 232966384, -19777602, -10127892, -20388352], [-90683827733, 298941016, -2626989, 12215435, -3843016], [5309423748, -52261868, 33854018, -37730564, 14518190], [-8863287073, 26934022, -14315517, -12460579, 1867066], [-1970655536, 216573278, 16058013, 55765700, -9125841], [-43013911722, 313985054, -25747804, 13569995, 31051918], [-107707121941, -100721695, -893547, -41913687, 19889692], [110783935517, -205912989, -2290946, -17192060, 6358365], [13116422936, 357140920, 11109322, 34524019, -78604], [-35355532498, 293353116, 6967160, 31464980, 26631128], [-13307020244, -276209078, 22465550, -21502892, 55603086], [81075166601, 6467712, -7743495, -22157703, 59897346], [-52323503248, -87039764, -38739034, 20811906, 65554804], [-46049192496, -81017730, 32311764, 51592060, -25230096], [36448819749, 63959723, -18070751, 48813664, 1374436], [-66094003089, 276498737, 12312966, 29364348, -21537363], [-14060851592, -254584418, 48507642, -3424764, -2063688], [16414164115, 59350985, -19140543, -38367525, 658168], [-12085793044, 289142698, 54881756, 19358994, -92440164], [7056829481, 36993733, 33065958, 4205415, -28793453], [120241148872, 101340528, -4688354, 74897480, -24290782], [-22474241341, 483876445, -24389064, 10899458, 12256749], [-60914780824, 9093684, -31524234, 22604624, -37489436], [35855497235, -210521771, 10386137, -6906107, 64403258], [51956036050, 102299324, 12044110, -40399212, 18771004], [28788589226, 312781054, 1313501, -7320378, -11976405], [7089463552, -346660252, 6362019, 5408146, 26031167], [-61340193098, 76979080, 16695514, 10973486, -5277964], [97666465354, 388757939, -17641066, 4973558, -39466448], [4241513871, 95822373, -14923496, -53813990, 28174391], [-4164051195, 67324905, -2045164, 59853437, 27574887], [-20724866469, 142571067, -55742152, 38822013, -54349509], [-8172120576, 489888972, -48184726, -83645724, 87341788], [-74034601847, -245563563, -24955024, 51520197, -69610077], [57320231422, -174373902, -57808940, -2462483, -16557308], [-91662919950, 284367354, -71708965, -57458762, 44313055], [113526641672, -124776708, 37977952, 1205252, -34227020], [-30267956361, -267160375, 59288744, 54410619, 16966345], [89156570573, -429858059, 26605227, 481168, 14741360], [3016948806, -119286212, -85415803, 24116478, -9311113], [41371990341, 37965057, -7936617, 67904793, 30706656], [689905552, -192973308, -35941507, 11081314, 32468971], [-86526290413, 641207510, 62742339, -36668251, -11035064], [-55744887691, -50124725, 32385126, -82404541, 75825197], [74620489286, -455141556, 112340, -9894838, 71882198], [-24774378822, 177491954, -2314186, -34032870, -44865714], [65678396745, -433070927, 396779, -67046479, -19999690], [29189632872, 300175552, -48282650, 408680, -18246374], [-85394921108, 38921544, -42868198, 15324192, -60519412], [67491645028, 160209006, -41744, -53828782, -11614482], [99656624504, -170427238, 57492754, 32277452, -28768218], [117490985133, -735090917, -14101974, 24470840, -31684853], [-41950937412, -542921362, 11308855, -93045752, -7921913], [21552006986, -221823266, 80749468, 34097300, -26888372], [285753029546, -228722654, -32776060, -14881134, 33475182], [53923742810, -105182470, -101718968, -49991203, 20850676], [124765923651, 492742833, 3840840, 1266430, 10920523], [-85031025844, 531085812, 47901260, 95769238, -80274226], [62950659754, -240467322, 87846568, -13805318, 18088102], [-41783287432, 293887086, 48216228, -16696010, 6445016], [85632416811, 157567150, -15301557, -55260741, -64515810], [34282737400, 987426338, 29549406, -110467134, 86757882], [161944393924, 742935778, -47874641, -46743090, -68818263], [325669154493, 373455302, -49181921, -61455555, -35299896], [-116834217235, 59265923, 124039347, 90264543, -98877452], [-133322416633, -415816, 46344938, -160272575, -23353093], [37985683718, 186683206, -49115040, 114908062, 53091332], [51447425762, 292701132, -60578674, 46149100, -81541140], [-239567672592, 400845036, -182505220, -58621337, 110781892], [-3496694871, 234169235, -55940661, 22197928, 94407344], [-195191444169, 452732506, 90417921, 71280285, -51384616], [-91917983811, -105838218, 49784793, -87944503, 87480496], [75631246980, -770487690, -75827995, -116189480, 83291817], [89050243836, 75924882, 40616883, -53808676, -41694855], [-162058477519, -861718967, 70736510, -28134915, 55552737], [352573580152, -411968264, -95091014, -74994636, 37562546], [290887749793, 349927821, -34312742, 91385251, 17045009], [105965784533, -314173968, 114252145, -42926109, -96119834], [449844544853, 511075846, -33425378, -69525219, 58087187], [339286390812, -40330810, 76887192, 87822364, -47418314], [-234504054098, -167056942, -37712044, -137794924, -52068396], [266334426468, -137491202, 52712537, -78792446, -11746611], [64116721403, 722285833, 19706039, 53619897, 153899618], [84266963415, -1186720905, 12879735, -127921012, 170376372], [207479544716, 126612074, -73733200, 169464720, -26337074], [101531517867, 445113409, -157200112, -149106169, -10537677], [81961362767, 70598044, 124916275, 139019625, -182775180], [218048437485, -239457445, 33341606, -77551617, -119656773], [-101272757288, 255829446, 77889549, 944788, 116783591], [150246242500, 1112118686, -55915426, 2058174, -116754466], [110206962114, 683169412, 58124484, 78168806, 10067340], [-134954862270, -964273478, 60508246, 92715024, -62042434], [272818647379, 437190371, -58025401, -26458514, 153881972], [-152247777217, -515556787, -60875076, -52917483, 197474363], [-163544098262, 1013227828, -101530750, 90456650, 78112846], [-217927442650, 475755050, -37770193, 79000984, -265214807], [-33837484279, -990079917, 38145762, 56065, -63045385], [244748431261, -693189199, -71724063, -137109726, 81975914], [92038195062, -657830242, -41877483, -65051444, -145855875], [57483494444, 1063350360, 5706908, -84846366, 27044480], [-198234773296, 1124200334, -29562290, 81694232, 27288168], [-80727023483, 290692515, -6312134, -97001621, 237944885], [29464928339, -3828612, 78676547, 109260343, -219758850], [210120509439, 1006418620, -67963273, -49916725, 21842656], [287130868272, -513167036, -16598380, -19913256, -36739810], [-51112689008, 1259765454, -128081586, 15289170, -48345002], [412475268325, 773487796, 19346802, 189344693, -149125521], [145911082236, 965388909, -157106699, -59829360, -132007067], [44641827493, -678633055, 101671112, -187134988, 187807173], [223323511595, -179536947, -203803554, 19083646, -13462431], [55287500891, 951951477, -110383821, -76300902, 46588162], [-195000932622, 133174334, -217050294, -38394114, 21321188], [-222390876910, -385034252, -125672889, 190432252, -318208595], [-164278253460, 624486052, 95334110, -143989464, 48763790], [-318793142830, 103908168, -229424199, -48207364, 170832495], [-410506690525, -1467226747, 41890244, -72423390, 124843871], [384919835251, -328147437, 78361872, -136400649, 245738737], [-117126158942, 43334066, -67183058, -155381666, -239223670], [21096753141, 240911315, -238968134, -97455292, 142678953], [-446247794736, 822396528, 24177460, 164521884, -253595134], [-585785281610, -292717924, 1349588, -199915774, -105053876], [7634224668, -1086984977, 80732253, 9835390, 52812671], [292991214088, 980037888, 61752928, 42752850, -203254924], [-570415863400, -1564510590, 157930718, 9529226, 167006512], [-220722133273, -606350665, -83394530, 165210591, -30778731], [-47949352877, -415068500, -185718251, 155868685, 306733306], [-284412767324, 1348534898, 87714022, -120773072, -13564578], [301770656532, -1170067622, 76621453, 130035416, -118947], [-224573431817, 621269557, 82494630, 88286491, -190538737], [-292126596478, 596730576, 247802789, 159989486, -94880361], [60687940, 964344584, 219242306, 221108202, 132566604], [81836848924, -861422548, -69487904, 50059710, -102747794], [-287733808480, 830052688, -187860358, 65100392, 211449794], [-89381858038, -2142749564, 156876496, -136933556, 306765420], [-150961495780, -424398764, -85365510, 102643145, 11165034], [-8644149793, 133753641, 99562401, -73664132, 38672826], [-194785413928, -150301748, -112704275, -184257728, -2409939], [-501403049106, -1700281270, -43384666, 197237094, -264788626], [-247187437821, 1494727369, 77030982, -39880865, 1906045], [-324830311507, -78672953, -314126294, -144535174, -127884765], [345671135422, 1549608714, -17569198, -47954093, 161730156], [-249411252770, -1412187419, -158068250, -50502118, 172118452], [-56852160837, -3488971733, 140108142, 144383385, -339386803], [16090571966, 1285731254, -152925602, 74336820, 7946900], [-246483759648, -732669684, -70369685, 41556654, -172599755], [-168852994224, -1350772021, 46421082, 368421158, -232236684], [-461625132357, 1306942570, 155531295, 76405527, 164517418], [-98781367079, -2478766980, -4152884, -341531065, 62025071], [225992236981, -1727238627, 3528110, -129902575, 140815283], [194142570822, 812700334, -66506126, 7791786, -192731276], [-177435717789, -1322822765, -301469306, -362948203, 249094465], [55616631143, 84598353, 253434119, 60169672, -89312850], [-424491964489, 633429385, -22346156, -30275604, -161389735], [-153042650354, -175540238, -315336901, 162916590, -161537829], [421513315020, -2026286982, -158553950, -310340890, 648361702], [-187240673544, 2133426771, 88671147, 168429024, -238332201], [-255053050787, -1351509041, -257883790, 26414090, -284391361], [-16596569004, 2017906324, -64819600, -203201071, -69113224], [52974874304, 3079631970, -192888204, -166798474, 279538450], [118998983619, -1533989117, 369992573, 449523143, -279383866], [119036125361, -1756811628, -357690257, 353048777, 96478074], [-791678819567, 1311591996, 62397141, 144672597, -306473754], [102529491080, -416624122, 193776894, 62426822, -327044844], [-330349485152, -342749118, -236308689, -370116892, 103914895], [341388865445, 1627585431, -66444691, 64491820, -58821888], [-105468269187, -188176232, 192589705, 153135345, 93034510], [142123679705, -941139404, 117594937, 544533871, -69962140], [-7808199628, -438385330, -66157394, 163619582, -384522142], [-15655231976, -1101415106, -326377894, 334653564, -329648686], [188275490742, 249868208, -291334444, -364919912, 443924496], [-99498377467, 697046781, -262399641, -465995075, 358791874], [709405625591, 2836102503, -210447610, 350990377, -219529335], [-578323874042, -895302288, 68326098, -266343252, -59625376], [130849507367, 129485985, 461293564, -10807633, 140965431], [-599405078476, -1928031724, -86962407, -282410002, 183215431], [466847592918, 377604838, 2785236, -718320, -387204266], [-204230550196, 308887516, 173757954, -156709359, -286594654], [-358480615763, 757520893, 303573967, 33118264, 114076406], [454518121160, -1781594752, -273918596, -426888264, 222272202], [308156908052, 1072046892, 240819839, 14552624, 133360517], [409173139768, 146849050, 231839113, -81667784, -107190593], [1082566997437, 115455034, -71486319, 102058797, 44857278], [188071755757, 2795503457, 85539019, 84050267, -523368010], [-338426663927, 1083094321, -44551615, -464643299, 242101808], [819215049431, -335060435, -234102940, -126202398, 588725765], [-1010691611268, 1304158656, 345643428, -155745828, 94513662], [-362472941821, 1631262980, -60597581, 257924951, 469794728], [-545370863069, -451079598, 22396506, -300517097, 455985341], [772842232928, -528668130, 160143875, 448913020, -79630941], [301926983958, 3004471424, -267118694, 260310772, -550312330], [-285941578575, 172114623, 228571301, 195747538, 449377494], [798490939161, -248939907, -8566549, 263034197, 340397568], [991141883787, -3792752859, -126245172, -36090576, -47911127], [38377226113, -3534005900, 38868572, -217395197, -84030369], [144991268903, -1626324405, 22619402, -220432301, -54541669], [881442461995, 854558321, 9054448, 498216785, -199303325], [-712800722977, -2955541951, 49865664, -81048480, -69172667], [338714917771, 983360079, 12100148, -353888227, 336198281], [573393371098, -720642806, 127138824, -310620438, 81214898], [469021265423, 2924764221, -377730857, 161673470, -186903654], [-160173717548, 696564600, 552135074, -118745752, -169689764], [738537974991, 738054425, 11608228, -201987997, 431374023], [-45340583632, -4431530476, -194647868, -306923100, 397583376], [-572276910997, 449648153, -600054362, -254058718, 266425461], [342046952183, 843292171, 33258593, -53507045, 280694158], [128479007839, -1994817911, -581820705, -53646017, 215108802], [131171515986, 1679455588, -238700574, -48634148, -533315654], [-686584403581, 2410972066, -322542958, -118770853, 17114677], [696699018210, -529985884, 524417840, 107830008, -720319202]];
    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_k();".
// 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_k(: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_k();".
// 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_k( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_546_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,8,sign)));
    Vf := Kernel([<5,R![-599455015900, -2538310720, 61226049, -102633, -509, 1]>],Snew);
    return Vf;
end function;