
// Make newform 354.6.a.e in Magma, downloaded from the LMFDB on 18 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_354_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_354_6_a_e();".
// 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_354_6_a_e();".
// 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 := [-857860, 78584, 10546, -1060, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0], [4060528, -5641890, 67029, 7095, 24], [-100418398, -186138, 1104904, -12131, -1154], [-113378224, -664164, 1644952, -18311, -1817], [-969727276, 391662, 10170031, -87665, -10142]];
    Rf_basisdens := [1, 202474, 303711, 303711, 607422];
    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_354_a();"
function MakeCharacter_354_a()
    N := 354;
    order := 1;
    char_gens := [119, 61];
    v := [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_354_a_Hecke(Kf)
    return MakeCharacter_354_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 := 6;
    raw_aps := [[4, 0, 0, 0, 0], [-9, 0, 0, 0, 0], [33, 0, -1, 0, 0], [-40, 1, 0, 0, 0], [-105, 0, -5, -2, 0], [205, 3, 5, 3, 1], [597, 1, -11, -1, -2], [-25, -4, -19, 1, -1], [-251, -7, 11, 5, 6], [3284, 1, 24, 21, -8], [-944, -14, 34, 6, -5], [1003, -10, 31, -41, 15], [1076, -5, 52, -81, 20], [1097, -41, -61, -26, 11], [3906, -3, 132, -25, -14], [12651, 32, 45, 38, -56], [-3481, 0, 0, 0, 0], [14364, -153, 130, -192, -4], [15893, 91, -33, -172, 31], [1861, 28, 59, -253, -60], [18464, 89, -358, 28, 14], [-3455, 33, -37, 579, 57], [20988, -51, -162, -367, -148], [63272, -26, -94, 179, 47], [53651, -41, -953, 413, 111], [42470, 56, 730, 216, 258], [10740, 142, 598, -256, 188], [39377, 14, -55, 736, 13], [92779, -612, 575, -391, -103], [14579, -182, -615, -1045, 170], [-13757, 633, 689, 701, 197], [-75602, -132, -1022, -542, -222], [50117, 352, -873, 820, -144], [-40537, -297, 773, -1159, -43], [-114829, -752, -781, 262, -219], [-126768, -770, 454, -864, -115], [39817, -1165, 1725, -1849, -285], [-102660, 971, 1072, -990, -432], [-175710, 804, 4172, 3447, 77], [-179778, -482, 4512, 561, 345], [-70511, 1970, 1105, -108, 660], [-178822, 402, -848, 684, 199], [-47119, -2152, 3169, -208, -546], [342192, 836, -2922, -2650, -1348], [166182, 858, 860, 2096, 416], [-86342, -1327, 8482, 2490, -574], [-243339, 1167, -689, 1556, 422], [42924, -650, -6140, 990, -2226], [119741, 1941, 5055, 3511, 234], [-104182, 3367, 1432, -3306, 588], [25442, -1798, 2378, 6194, 364], [-119339, -380, -11389, -5789, 416], [-270060, -2900, -13994, -4028, 392], [-715401, -1090, 7541, -3635, -1148], [49428, -532, -4514, -8908, 728], [-170476, 376, 15990, 8083, 1725], [494711, 1868, 8017, 10973, 68], [-703683, -2515, -11501, -10031, 1039], [-149583, 4117, 13835, 13720, 547], [156008, 4326, 6330, 2626, 2616], [-427767, -551, 21083, 2678, -258], [759997, 55, 5901, -2663, -2428], [-2173920, 116, -4420, 2258, 856], [978871, -2132, -4269, 11952, -2407], [339925, -2316, 9629, 4677, 2023], [689111, 4736, 1741, -2774, -392], [-135894, -11934, -13614, -232, 564], [-1059463, 5790, 2541, 7517, 845], [-679350, -2883, -14864, -2839, -1206], [87997, 1165, -3, -10427, -2635], [700745, 1806, 30053, -10792, 5077], [15768, 7354, -13400, -3408, 2706], [93995, -9619, -2507, 8850, 1471], [289971, 7209, 21093, 15808, -1064], [1001447, -14141, 23137, -6809, -1917], [955653, 9460, -39865, -771, -822], [387550, -16782, 14240, -3444, 1074], [-186285, 12027, 26591, 6495, -7017], [1547331, -4438, 22939, -14910, 4805], [-820466, -2396, 52384, 10980, 1308], [1999766, 6678, 3226, -5370, -2242], [-2419735, -5471, 20577, 30323, 1897], [1508634, -4577, 38576, -10279, 5746], [-762057, -10009, 5193, -25334, 1400], [509115, -17008, 51701, -5115, 1613], [2053529, 16787, 8375, -3161, -1016], [3169629, -18002, 40791, 962, -848], [3087942, -4961, -4688, -12764, -172], [3095721, 14035, 25665, 9115, 1136], [246121, 9007, 25211, 3044, 936], [-1216272, 11590, 3520, 15644, 994], [4086297, -3314, -42867, 40892, -1761], [-707559, 10574, -3473, -14101, -8139], [1207708, 16660, -5578, 25777, 11887], [768317, -35393, -29493, 6399, 6831], [-28842, -9079, 64648, 2605, 2012], [-2788836, -2656, 7862, 13945, 10197], [1394760, 22555, 112324, 33133, -9692], [-1528693, 29491, 41793, 46655, -10025], [2240927, 29745, -64633, -13309, -3565], [-1978085, 7070, 12833, -43065, -5565], [3279802, -27520, 74792, 26330, -13468], [1232879, -19426, 47555, 7246, 4250], [-777288, -3740, -16366, 24349, -15545], [4590705, 7639, 28567, -3132, -14483], [-4668185, -12985, -26999, -45430, 1557], [607365, -53018, 12945, 5790, 5984], [-3734192, -11277, 36680, -1923, 1496], [-4838468, 692, 27300, 32964, 10098], [6348037, -16150, 209, 5819, 75], [1112577, 35233, -157433, -23695, 11247], [2661392, 10552, -9418, 55292, 10870], [2006531, -16681, 75339, 34407, -15614], [-102941, -15549, 80785, -25419, -2299], [-1946481, -42459, 85353, 12673, -11635], [-994715, -30772, 53751, -98422, -8598], [-729247, -20868, -33745, -59869, 979], [3737516, -44592, 75140, 3164, -16720], [-4754976, 4563, -20284, -46365, 33728], [-5881027, -50919, -84885, -95849, -26814], [7508264, 34746, -88982, -82414, -13577], [-1516874, -22940, -168456, -42738, -344], [-992040, 37078, -21170, 53564, -13176], [-1801273, 29144, -110669, 36628, -30998], [6354794, -32906, -93884, -7966, 3248], [-3445188, 29372, -15354, 5341, 26869], [-2231022, 23584, 6492, -22464, -2238], [2948265, -40331, -81973, 44179, 6992], [-657130, -22908, -225974, -101608, 13044], [12303959, -2545, 13509, 2492, 18037], [-1641019, -2211, 111659, 8820, 788], [-5539111, -26806, -102415, 3150, 2857], [-2195014, -66132, 238752, 38304, -3638], [-24341815, -9377, 107, -17074, -5516], [-1790819, 12462, -92325, -15604, 19690], [2733961, -7122, -47379, 142039, -27319], [358486, 46930, 65098, 39872, 26636], [-7654742, 20306, -28450, 90466, -29992], [1884666, -19160, 33590, -109906, -10914], [743115, 31580, -104053, -104392, 32457], [8065144, -30804, 139642, 108846, -3438], [-6260286, -10090, -289420, -21961, 9901], [5148157, 54947, -191493, 53630, -5153], [-5283323, 62306, 79315, 136261, -20984], [-6976262, 58870, 175752, -125618, 19373], [-8506465, 31050, 230487, 79118, 21634], [5955639, -38455, 57705, -74040, -28310], [-8623289, 49350, 1249, 68665, 66710], [4299626, 81414, 328440, 205338, -6546], [-11179383, 26581, 323731, 13751, -25052], [-4732722, -45994, 36224, -94924, 20798], [4500042, -11242, 154982, 92712, -37528], [1570436, -133164, 7292, -8400, 16724], [1907103, -56994, -41765, 37950, 34744], [1367805, -32067, -266285, 91649, -11331], [8234150, -133368, 167784, -69149, -51039], [598246, -27742, 6560, 28480, 21280], [1168989, 72822, 9783, -33721, -40456], [1668751, 165959, -274241, 1441, 26055], [7479319, -106844, 30173, 42165, 30304], [-18199496, -50318, -33350, -16879, -35325], [-7120792, 14120, 141786, -174612, -25284], [-11943433, -97795, -403023, -138872, -12316], [7029521, -109862, 47477, -25726, 45953], [-432215, -32294, -77789, -105503, -17638], [-13572505, -80518, -215481, -35548, -34318], [11583293, -13251, -173277, -321718, -27620], [12345628, -95134, 65986, -90538, -24573], [-2790264, -68120, 201438, 126250, 24696], [7729278, 55562, 620922, 221524, 22942], [-29129761, 84466, -152787, -82419, 31154], [18895206, -186172, 168412, -118228, 25348], [15575969, 163332, 100217, -61594, -15315], [-3284641, -91533, 101883, 88081, -24227], [-12440924, 33900, 215356, 174492, -11416], [16934963, 934, -380863, -127660, 24902], [-7471853, 137929, -308767, 17263, -51925], [7261274, 209600, -191870, 38124, 22922], [-18317327, -145640, 186603, -204051, -78147], [21856058, 98756, 102128, 209694, 38332], [-2864798, 219388, -192142, 90636, 38504], [-6273940, 818, 327012, 120494, 33458], [-23245411, 171175, 375377, 18865, -47393], [17116294, 113192, -26300, 128724, -2690], [-10874943, 77470, -359757, -85275, -17506], [20832509, 111552, -158287, 6304, -52011], [-29414178, -104054, -44764, -275466, -89000], [-14146852, -74764, -464678, -310594, 74994], [-27925789, 42351, -43697, -25999, -50637], [23128355, 144817, 52253, 237223, 13808], [26789055, -340863, 401671, -77997, -44767], [30819217, 72258, -59151, 341850, 15894], [32504100, 55582, 201670, 45172, 47150], [18921422, -132279, 381602, -30413, 28986], [19525072, 134410, -1139616, -95966, -7046], [24461619, 136372, 553547, 7198, 48283], [-12675429, 68627, -265355, -244314, 96178], [22942346, 128025, 169116, 314136, 78126], [-7012216, 116658, 202550, -96469, -60363], [28273041, 36161, -367781, -346679, -30888], [23010464, -101582, 32518, 271506, -108434], [-19163081, 12599, 71393, -102495, 81867], [31745765, -115525, -558661, 258292, 4948], [1765469, -140384, 64593, -355795, -99777], [3618338, -54392, -215166, 206790, 114842], [-7195438, 85772, 98472, -132233, 152107], [-13368013, -50169, -898751, 63186, -105721], [-7954547, 121531, -290485, -3325, 46606], [-22708047, -139558, 601177, 211314, 80343], [32440664, 36562, 179214, -86200, -12920], [-11333453, 317498, 306595, 208545, -12953], [6504291, -240916, -255435, 170470, 11698], [27014857, 34466, -908705, -525521, -68831], [-6925006, -114938, 344890, -255814, -47894], [16190461, -98640, 956939, 132995, 105210], [48090057, 75210, 408457, 48673, 6929], [-40512311, 78011, -377329, -1519, -124341], [23255884, -289339, -394012, -537375, -21892], [24402615, -129029, 561781, 138481, 53646], [22078829, -154656, 448819, 196118, -11812], [-19492223, -210425, 423453, -224847, -77861], [17385093, -284131, 911807, -33750, -32625], [-17416168, 67822, 878120, -97214, -72086], [-7974172, 66279, 89752, -525046, 86272], [-442644, -18726, 650100, 130572, -8772], [36400098, -311301, -808092, 135006, 63572], [-6272145, -97469, -359965, -336193, -138170], [23219454, -242932, -369254, -443716, -39434], [23753144, -140034, 614338, 572560, -119098], [32842103, 69094, 264855, -524296, 6399], [-26055102, -189247, 463284, 547872, 57980], [19746747, 288791, 871613, -32872, 75], [-21725189, -132641, 778657, 45174, 79044], [-1919925, 250340, -783123, 476263, -144800], [19549338, -54228, 396240, 582558, -13992], [-23057823, 262220, -744489, 272647, -9440], [-35140215, 209007, -185751, -269265, 237913], [37224058, 262158, -1136396, -215411, 16391], [-51260755, 50212, 323289, 317748, -14220], [-6145168, -201338, -1214, -644529, 52491], [-10105847, 27042, -895733, 2847, 119292], [52415484, 126750, -55558, 562258, 232222], [-22535507, 98817, 108539, 229303, -85467], [-11063552, 100648, 1131906, 348696, 168682], [-56242479, 259485, -1014059, -8123, -13286], [-8496922, -130824, -937104, 730255, -156499], [1436353, 20947, 816107, -419898, 126845], [-42213199, -150522, 1043585, 349618, -77330], [-9411048, 175587, 258796, 636016, 215926], [-9628835, -271912, -295837, -1033433, -58066], [-2786231, 377419, -890545, -188138, -56430], [-3184211, 598980, -17315, -121240, 7203], [22470946, -22749, -26976, 327625, 2936], [-111866203, -3961, 156231, -27406, 40999], [-20047111, 201120, -1407421, 51180, 31354], [-22257929, 331992, 584785, -32701, 135606], [-15503849, 443207, 1209809, -182136, 25303], [114816160, 224348, -481722, 358014, 128918], [138051417, -107580, -152093, -305529, -107212], [48889151, 442131, -1440599, -377310, -53726], [-51274423, 573019, 737951, -442028, -31445], [52884305, 400368, -184081, 542057, 128136], [-51704510, -65612, -101008, -753898, -208466], [61757454, 165222, -432596, 192200, -337024], [11653475, -746434, 95329, 164212, 77380], [93467776, 70072, 454194, 66158, 174140], [38927237, 174749, -12667, 786081, -93182], [72132340, -374698, 289524, -354942, -47844], [-16773581, -550471, 576505, 190739, 264469], [-27925613, 127682, -55975, -174366, -81580], [-29629038, -130506, -893276, -675034, -161394], [41468762, 200075, 540958, -244282, -215556], [33588953, -166800, 178229, -435795, 28115], [76407019, 116085, -211823, -326561, -440783], [-26609395, -171639, -669497, 640770, -64183], [159737535, 42479, -970435, -672658, -56044], [72657970, -369334, -771848, 662379, 122185], [-67495635, -94045, 1313259, 1184566, 28913], [13107203, -267425, 1354851, -516971, 6359], [67820977, 474222, -2039453, -955885, -13818], [-48170563, 350772, -669569, 447061, 266436], [27533930, 283258, -1107484, -160402, 234612], [27227856, 782276, 571220, 378750, 100854], [-114372442, 39992, -181768, -117774, -202812], [-42726871, 1741, 368259, 266974, 483225], [-10134668, -449385, -1182830, 894851, 17568], [-17086343, -103391, 2948657, 637071, 89175], [62584085, 8993, 509029, 58899, 322382], [33083623, 359465, 1298253, 1037244, 239717], [42016714, -129268, -1772464, 403928, 283784], [77974523, 528034, 51205, -38571, 248792], [-1401850, 96416, 25802, -984760, 249514], [-112788593, 295337, 112339, -694415, 241156], [-72099917, -504984, -1241917, 136552, 19726], [-59474295, -629531, 322283, -430862, -146665], [39923995, 234380, -232863, 376573, -190830], [64093080, 450469, 1427828, 119466, -293840], [-92875437, 92288, -1169839, -182078, 86078], [-61530576, -126211, 519110, -487619, -52152], [-35333283, 254337, -203617, -573032, 209909], [-91078622, 292240, -1564204, 292568, -336453], [-34946545, 724274, 2259545, 138365, -415068], [-41388879, 152083, 2390331, -229742, 180163], [75189318, 433840, -472726, -720934, -335368], [11586540, 91232, -1511324, 527774, 7108], [-120773199, 648929, -896475, 517777, -113799], [47773947, 203068, -216419, 781355, -238524], [-97479346, 1132811, -1157044, 314546, -180400], [-108930754, 241129, 364612, 1443525, 210280], [-104890722, 144434, -697024, -390826, 335732], [-150564457, 318602, 1615365, 1439499, 46338], [-85962385, 225237, -874209, -1192321, 12520], [-153919821, -175608, 1084745, 529508, -132950], [-70818700, -51342, 598226, 1217558, 426185], [-160861493, 425366, -857741, 163794, -13229], [29381343, 36095, -868133, -856231, -119765], [-151044468, 203961, -522846, -665759, 525896], [8642771, 321536, 841953, -1159101, -51190], [98101568, -738206, -1347430, 1250992, -161848], [-34834659, -473776, 2732335, -899950, 220340], [-11778578, -699420, -1186986, -304102, -369876], [-80763902, 451376, -1208644, 921874, 163526], [-148798016, 271375, -955004, 597759, 339752], [-125266878, -626676, -1314842, 852264, -149688], [-63516351, 675918, 750379, 432162, -147796], [-41667278, -726392, -2722728, 42278, 40716], [68612497, 263049, 1738839, 954280, 400737], [21440522, -249882, -982778, -395944, 100104], [-188984312, -64842, -1846984, -1073580, 148442], [-138312802, -179612, 89868, 785741, -215021], [716359, 823174, 623183, -1349209, -209067], [-17140756, 704606, 724232, 1867022, 303652], [71064312, 1483658, 489154, -583560, -49206], [229687149, -398496, -1829181, -1306023, 116324], [72975653, 48722, 790391, -1530019, -99989], [66574440, 647126, -9094, -1372311, -635441], [86943922, 577214, -1637588, 196326, 282503], [-88345182, -967028, 2744662, 71774, -337140], [171510, 533677, -577796, 744990, 149394], [159534639, -382035, 692565, -56153, -457561], [-51415402, -53208, -260960, -10202, 16926], [130844851, 794086, 3563473, 676585, 255906], [154600658, -231292, -2843014, 2383562, -96682], [240465472, -834418, 1944446, -599412, 443438], [-21939558, -82658, -3240126, -371234, -365488], [-76947935, -411070, 3394061, -379054, -174930], [177915237, 113319, 214293, 981443, 405595], [151561184, 1052316, 2810668, 321010, 159496], [100320885, 1725174, -1105935, -639326, 71036], [204024149, 563522, -745377, -683237, 237986], [-29028331, 659545, 1677355, 1549526, 137004], [-116525494, 1574626, 941660, -124728, -315923], [48527414, -794951, -3039874, -2597985, 38150], [130263220, -486384, 1000626, 1261782, -115187], [42422972, -63672, 4863606, 479564, -76525], [69048836, 394846, 3727668, -415620, 210], [18663354, 429568, -4482742, -625148, 57192], [54019234, -849190, -656960, -179785, 544927], [-80614309, 17917, 1224395, -1998621, 48744], [-78157447, -532506, -937725, 225285, -291560], [44417499, 683189, -2187533, 658129, -318849], [14228765, 43471, 2550481, 1507039, 17708], [-33675492, -955694, -1925912, 431834, -538574], [162902959, 1869448, 3877775, 312658, 225892], [-52546458, 530885, 2968326, -823932, -300296], [92563832, -1427081, 2734858, -97862, -330370], [135622024, -1604356, 787348, -1536566, -211040], [23614252, -935862, 5045436, -68722, -112644], [-101552806, -944358, 602368, -513540, -358738], [146133824, 407118, -1519250, 1241843, -613159], [187419195, 522165, -200343, 683534, -579641], [-39880333, -232324, -1998369, -579490, 513780], [-53420923, 406307, -2351471, 636467, -419472], [-33844612, 25276, 21122, -1862260, -649598], [37843610, -917328, 78448, 286218, -733249], [223803787, 454433, 3143105, -44703, 183986], [20675691, 392645, 588249, -2910227, 195054], [-30605430, 2264951, -2591884, -77974, 302156], [43602910, 566698, 2528174, -967458, 636702], [-135102587, 1081657, -5382465, -848714, 250349], [42982612, 60562, 5291002, 2180508, -1956], [-83961772, -1455514, 974026, 1487927, 68397], [-217114625, 249566, -1672871, 399131, 379995], [129962619, 938494, 251193, -798095, 606652], [-27675387, -833701, -127281, -138105, 444965], [-62496209, 921054, -2189237, -279148, -137670], [-30409557, 679295, 865021, 3008249, -509411], [25325118, -727116, -3504232, -1456398, -376297], [-279815103, 1169716, -178849, -1364805, 710195], [192929409, -706208, -1094939, 772770, -112856], [41893633, -247993, 5591165, 917117, -155967], [-105999413, -964582, 6335387, 1817204, 318209], [155829489, -1371897, 1593491, -971667, 762634], [-147220702, 929036, -1580876, 1282840, 855062], [51128044, 702635, -4244122, 952099, 590482], [-337627448, -651880, 1960938, -886620, 349526], [-14946288, 465879, -2846676, 1346352, -58590], [217291710, -1213722, 3318020, -358112, 807506], [-229343777, -217468, 281409, -1082661, 371381], [146243199, -51538, -4906175, -1624028, -47310], [356004689, -187165, 476123, -133800, 365717], [-125724806, 291576, -7281462, 1140578, -864628], [-330448982, -2103082, 595938, 922662, -281104], [-30929010, -2199507, 359430, -2294835, -587966], [-23466833, -1778445, -5430705, -2308231, 456672], [51942433, -491613, -661225, 1787546, 191031], [-10807198, 1294026, 3349908, 2578084, 23396], [-95034898, 988314, -1077932, -125184, 115924], [-173437851, 2201383, 674535, -735636, 289761], [85493383, 197786, -4842127, -571969, 360194], [-2759945, 1360323, -3132999, 178148, 229540], [41849530, -397645, 2856966, 2641359, -305242], [-241364641, 136735, 4280585, -2203911, 144914], [298326331, -1243543, 1016861, -2071419, 477943], [-338107211, -1612607, 2864135, 1549600, -158315], [188332116, -1741230, -1420370, -4742774, 82802], [140750804, 1908426, 4431316, 29926, -300330], [416120228, 606194, -135918, 1689982, -479017], [187001665, 969822, -3397921, 245637, 453850], [-261470470, 629636, -4844716, -2356917, 651591], [23761909, 258952, 3964833, -1302716, 948341], [11826763, 2290939, -2920331, 2766458, 1018047], [-103898387, -547608, -1981283, 2382862, 321861], [123673404, 730018, 4056780, 4072634, -529616], [26599680, 1355640, 1433386, 147322, 13532], [96432936, 1493882, 3762654, 1826168, 185062], [5485473, 40357, 3818971, 4009319, -545992], [-54745736, -633941, 3643872, -2160185, -1076368], [155347972, 306345, 3491580, 229792, -1079928], [-159240303, -870970, -246157, -4030043, -1064932]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_354_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_354_6_a_e();".
// 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_354_6_a_e(:prec:=5)
    chi := MakeCharacter_354_a();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 6));
    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_354_6_a_e();".
// 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_354_6_a_e( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_354_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,6,sign)));
    Vf := Kernel([<5,R![-160346070, -25942643, 771476, 1482, -166, 1]>],Snew);
    return Vf;
end function;