
// Make newform 354.6.a.g in Magma, downloaded from the LMFDB on 24 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_g();".
// 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_g();".
// 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 := [-353376, -11664, 26492, -404, -358, 0, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0], [4257918, 2808606, -229231, -6156, 1148, -34], [-13795668, -3340824, 616126, 82266, -1742, -251], [-11662758, -1456758, 299605, 39594, -584, -134], [-58414446, 8886672, 1407292, -165030, -6143, 598], [-58933332, -23388948, 1976846, 539844, -2557, -1702]];
    Rf_basisdens := [1, 130266, 260532, 130266, 390798, 781596];
    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, 0], [-9, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, -1], [-9, 1, -1, 1, 0, 0], [71, 3, 7, -6, 2, 3], [-88, 5, 10, 1, 1, -5], [155, 6, -22, 19, -3, -7], [253, -3, -10, -8, -3, -25], [279, 12, -42, 45, 7, -27], [-250, 16, 130, -25, -37, -12], [-939, -11, 250, 18, 22, -40], [-3431, 26, -27, -88, 49, 15], [-22, 5, 81, 79, 121, 76], [-5609, -6, -215, -101, -102, -85], [-1928, -29, -515, 155, 81, 106], [-2831, 28, 164, 80, -150, 61], [3481, 0, 0, 0, 0, 0], [-7291, 40, 182, 221, 20, 80], [-8711, -4, 903, 907, 0, -253], [14046, -264, -62, -240, 73, 159], [-6203, 189, -1921, -359, 252, 68], [14398, 142, 199, 433, 123, -719], [36502, 283, 1727, -177, -73, -920], [55568, -42, 2457, -598, -55, 276], [28558, 202, 2415, 1267, -193, 1093], [83400, -204, -3044, -1002, -276, 580], [51470, -1223, -2771, 374, -260, 460], [82928, -57, 816, 502, 286, -377], [63147, -114, -2617, -1034, -41, 1071], [44598, -445, 5027, 3160, -535, -1085], [48406, 70, 1275, 593, 1417, 1263], [84062, -512, -5626, -3284, -442, 894], [38433, -397, -11143, 2942, 1196, 107], [18248, 1072, 1041, -2641, -1235, 195], [170042, 1353, 3630, 2688, 2474, -3215], [41693, -1301, -6390, 2714, -2248, 764], [-91830, 2621, 4952, 1541, 497, 275], [99079, -555, 10439, 5115, 1614, -436], [192296, 829, 11964, -6012, -893, -82], [73154, -1450, -12137, 770, -4137, -3534], [143349, -1147, 8457, -5980, 1572, -2207], [70763, -4222, -2177, -1976, -554, 2582], [185301, 2769, -7833, 1350, 124, -3031], [-153358, -3442, 2970, 9300, -74, -6382], [-65072, 3393, -2441, 1064, 3668, -648], [-22555, -2535, -18171, 3517, 1766, -2986], [-68158, 4924, -15084, 8519, 964, -2477], [-94194, 362, -28584, 1118, -2598, 3344], [-87775, 958, 25604, 10561, -3355, 581], [-91615, -2050, 2496, -1591, 5634, -4042], [-76354, -4128, -4082, 6616, 978, 8100], [234222, -4794, 16268, -7288, 2049, 9091], [83692, -150, 11554, 340, 5844, 9438], [247112, 12613, 685, 2564, 5623, 2317], [64980, -2090, 15462, -9864, -8572, -5674], [-962, 2397, 18816, 1284, -7621, -10120], [12800, 1037, -18653, 10846, 9431, 7583], [210814, 6330, 2121, 23285, -175, -9111], [-429089, 1820, 46309, -23507, -5842, -1555], [67140, 2552, -4584, 14690, 698, 878], [47062, 7328, -40940, 14117, -4090, -17469], [-43951, -9039, -3187, -2281, 14883, 19433], [-900146, -154, 3838, 6004, 9354, 11544], [980180, -4182, 21037, -16030, 2938, 14181], [-713213, -3905, -1188, -20400, 8083, 9529], [-270879, -5694, -20154, -18416, 9394, -15039], [639716, 11366, 20514, 710, 19136, 11954], [-485629, 1299, -33706, -2006, -19769, -28195], [303242, 2499, -17251, 39867, 1219, -35518], [-15416, 717, 814, 24151, 2223, 17083], [188672, -9855, -18534, -4238, -12468, -26013], [937004, 5265, -19147, -3468, -10440, 43804], [262335, -20235, -50666, 4799, -6722, 34733], [827394, 6252, 40492, -39781, -5644, 9313], [145560, 7326, 7113, 2439, -6005, 2703], [1479386, 5620, 42144, -8192, 14199, 5891], [2798, -3655, -65335, 20744, 10992, -47080], [796608, -9977, 11830, -33659, 4173, 41449], [1278432, 5947, 28612, -42, -15518, -39419], [1668778, -16786, 34494, -6244, 17196, 8888], [656148, 18672, 60578, 30386, -15830, -9182], [420190, 14675, -58260, -1361, -555, -3013], [376240, -27171, 24347, 27301, -10317, 22578], [-818438, 25054, 62202, 39485, 3306, 34597], [2583295, 28097, 35804, -47832, -11227, 24919], [1516721, -9024, -180516, 22519, -23459, 7633], [559737, 10761, 136775, -75980, -126, 10975], [1509135, -27853, -13113, 27567, 28260, 25182], [-1552493, -419, 65109, -4617, 12489, 61313], [2071420, 10951, 57639, -20507, 14108, 51627], [90564, -15824, -66162, -58666, 13356, 50084], [1287358, 1534, 190187, -49748, 15286, 20119], [-1534471, 62173, 31156, 56146, 12179, -20267], [1680670, 21160, -143377, 64334, 21265, 24544], [-965658, 28192, 62963, 62623, -9393, -53415], [-2437772, -2305, -28389, 73951, -6777, 37626], [265258, 9774, -79885, 57696, -2473, -60032], [-1200124, -17583, 49141, -86969, 26863, 7248], [-269860, 20466, -48011, -123841, 34539, 20507], [-2474382, -31471, 212500, 68739, -19955, -31959], [244909, -48239, 275730, 4870, -37341, -4361], [-3093356, 40687, -257847, 34830, 13214, -2928], [-1798193, 33821, 149607, -22880, 23718, -46589], [-2114460, 61220, 36159, -32508, 63067, 39184], [657939, 28046, -298657, 122887, -23192, -103477], [-1940769, 25930, 150673, 52399, 14720, -42269], [1400211, -20745, 222283, 25136, -39506, -54507], [-854488, -17245, -99401, 209863, 31279, -30172], [-2351966, -55951, 133605, -77674, 26352, 15312], [902191, 36259, -74852, 170098, 35489, 40785], [-1224710, -46524, 213227, -42711, -52639, 60745], [-2239286, 25743, -83477, -181834, -52812, -34746], [-2293025, -45600, -183868, -17087, 83249, -14349], [-337824, 3382, -291265, -157321, -39007, -31261], [2114194, -54500, 236017, -78583, 79653, 121855], [48013, 77615, -158737, 138722, 18118, -57905], [1652033, -49631, -394394, 7836, -58809, 153549], [-872592, 20665, -159037, 134478, 23792, 184896], [-6388298, -12234, -242512, 4793, -30587, 134864], [657013, -774, 52948, -145047, -15319, -33127], [1970911, 34768, 133765, -168384, -44052, -10940], [3295748, 120526, 56470, -77412, 93502, 75432], [375666, -25043, -225313, 249328, -16820, -213994], [-632821, -92197, -77767, 207006, -66776, 12939], [5293366, 44032, 394630, 2432, -46838, -112970], [-815934, -64638, -214389, 122740, -33341, -183436], [-6737776, -113536, -95934, -127312, 16572, -118260], [-3273853, 83740, 18780, 246717, -48207, -130535], [2414398, 95500, 275792, -16724, 102284, 41314], [-3078539, 22568, 418747, 11911, 163686, 152567], [984934, -97164, 363334, -13799, 16652, -13349], [-4420622, -18856, -346313, -422736, -46168, 176051], [-3056140, 11235, -384655, -105688, -67616, 23442], [-2971232, 8400, 308812, -48655, -24450, 107139], [-4065499, -34083, 133101, -188012, 46176, 45859], [2452393, -1851, -166164, 273538, 39681, 106885], [-18909148, 60178, 9868, 11088, 32144, -53992], [-3974990, 4498, 283518, -216190, -17070, 186746], [-9022658, -206922, 519442, -120438, -35462, -16860], [2522836, -131211, -341682, 82656, 42472, 150801], [9206072, -35340, 270672, -36618, -119598, -180652], [-4756108, 45892, 295913, 68318, -42747, 110766], [8580463, 16341, -247606, 150653, 86850, -54529], [-7182338, -15693, -363585, 119020, -28697, -318849], [9199435, -137250, -603491, 157744, -158820, -92714], [-1080193, 208561, 88771, -45832, 68262, 160435], [-11262828, 44946, -19880, 385859, -116840, -142959], [-7579252, -3605, -488237, 8580, -119601, 137163], [12923032, -24484, -60436, -29428, 71886, -130722], [10327775, -57252, 779492, -257819, 106929, 43109], [3331914, 45196, 130478, 14870, 85912, -175668], [-3505420, -54068, 217198, -288480, 3160, 341696], [3484088, -34292, -410056, 203084, 48392, 174700], [10528605, 160891, 18935, -33040, 55622, 19303], [12078688, -19788, -666347, -113019, -85075, 310093], [19837428, -27493, -59586, 324680, 71291, -112006], [13816384, 79321, -83567, -318702, -68704, 191474], [-103970, 72481, -46981, -265188, 138869, -134939], [-4341510, 59884, -572359, 80191, 34843, -285519], [-7770600, 47631, -880719, -24626, -161401, 1067], [15704052, -111430, -224103, -153772, -162935, -275080], [-9671536, -290420, -289192, 436096, -208896, -190734], [12083624, 33753, 842585, -73577, 62868, -362531], [-7464258, -23129, -230168, -179958, 62528, -534249], [-456878, -69651, 49421, -191872, -187557, -422883], [8168205, -83503, 615931, 27820, -9736, -377429], [13300644, -360269, -528581, -74637, 44898, 281351], [9541999, 66482, 156719, 575120, 213884, 150436], [13357614, -141456, -583212, 69828, 44326, -188066], [1326318, -184830, -99342, -40052, 62008, -75352], [32663762, 81403, 28613, 350952, 132655, 114609], [8350438, 67011, 431393, -120142, -148788, -115508], [9481780, 385982, 151789, 370742, -100184, -263913], [14060908, 183560, 739323, -356741, 282815, -303275], [20894856, 113320, -111172, 154424, 137828, -232600], [13957367, -175803, -1557123, 229928, -130060, 166917], [15362866, 101410, -388159, -50671, 100047, -13309], [-12329124, -57522, 413766, -126034, 162424, 373132], [-2501267, -326481, -104810, -107736, -194547, -364911], [18227596, -3432, 800836, 437396, -120122, 84952], [-12246850, -72388, -921284, 668628, -149920, 503890], [7579410, -70084, -229082, -396830, 64178, 117712], [-902680, -96707, -882096, -1067763, -144181, 392159], [6804160, -211560, 849566, -316076, -160912, -163484], [-3604960, -136864, -862524, 1144162, 186847, -229497], [-5348054, 162563, -625044, 283160, -177652, -31301], [-11510598, -59795, -586529, 117420, 101698, -707060], [25250588, -243928, -857728, 338858, -117262, 346168], [-20096282, -25574, -526225, -920393, -7261, 166501], [-1696931, -35896, 221632, -868835, 96381, -361553], [-21657088, -190454, 553877, 175733, -126115, -435295], [5077425, -395537, -108503, 711352, -138882, -47907], [-28405768, 45640, -254428, -382504, 161676, -476928], [-6648868, 364734, 702958, 455259, 105569, -477422], [547698, -229328, -1120642, -498382, 76522, 407756], [-41645680, 239749, 1180316, -152248, 292378, -31691], [-19640936, 79290, -62372, -387379, 237058, -52735], [-30600337, -169896, -772068, -411897, -176016, 17070], [30077358, -167642, -1557981, -175118, -331283, -377652], [-1355559, 79624, -922620, 763681, 148739, -903219], [10332266, -392377, -182605, -693144, -219214, -56450], [-3162638, -232988, -566865, -637313, -428199, -264425], [-37341886, -122852, -836864, 426513, -127396, -217561], [-14300441, -221695, -1666586, -1056676, -100141, 917489], [-2991842, -309840, -374630, 660800, -394406, -307794], [-15070028, -162888, 549363, 178924, -306095, 507182], [-2256775, -321325, 1066152, -450507, 305978, -260983], [-35681105, -326330, -285708, 640775, -178095, -194835], [17000408, -176295, 1473352, 970158, -223458, -447677], [-50630802, 120472, 263990, -349272, 294588, 889412], [-26288773, 4599, 293668, -67906, 244891, 659459], [26622583, 123310, 164812, 56552, 454606, -141199], [-40614143, -344023, -870952, -160814, -36937, 699777], [-11367092, -647198, -407424, -707770, 52902, 2990], [15871392, 79512, -52012, -1350660, -122783, 503451], [-10603837, -208295, -1745000, 1200230, 1119, -621723], [-19248416, 36334, 1242841, 960655, -325243, 77649], [-5602758, 405807, -1496433, 1355057, 348499, 987116], [-2402021, -66970, 2687324, 329615, 564299, 146463], [7078375, 299254, -1374010, -649764, 56450, 525695], [-36162724, -114179, 2604556, 214341, -185261, 201351], [-18066071, 75899, 1053688, 334211, 316866, 770467], [-24818082, 213298, 486518, 362012, -134018, -633278], [-54368889, -262971, -547401, 30179, 278538, -38480], [34090082, -285730, 529670, 1070330, 435576, 353796], [-37580087, 299626, 1411580, -651955, -389926, -690030], [47559847, 155064, 1664240, -336575, -127023, 673647], [11886052, 375782, -98676, -1157688, 281772, -400174], [10458412, -204251, 1456759, 125702, 267564, -241884], [25067644, 228885, 557368, -481902, 914158, 339277], [-16008191, 546262, -410972, -185101, 336116, -1107810], [9876007, -137146, 2796737, -1156801, 254216, -685083], [-26997480, 460717, -523063, 1340845, -46938, -1671055], [9247582, -16991, 516475, -1668130, -170255, 39179], [-26461060, 172652, 754118, 1129958, -164322, 272070], [16199266, 501094, 2396200, 1716092, -265427, -727789], [-22559680, -449404, 2392135, -798725, 17353, 216231], [-3752364, 282746, -766831, -753206, 407343, -821394], [22008543, -339601, -3198857, 309866, -157740, 237993], [63618462, -41049, -1064260, 82830, -219705, 45952], [-11877072, 12005, 3323177, -657904, -376707, -303881], [-24012442, -234942, -2343470, 523136, -249826, -154288], [-99843218, 387868, 1557885, -455015, 214447, 416189], [-39977154, -649996, 291134, -323624, -96644, -878718], [-903091, 95148, 3683516, 53539, -697625, 796101], [25207276, -987399, -2469432, 1425596, -153849, 109502], [44729645, 366137, -138932, 1126533, -340102, -1356377], [34966709, 430041, 2654183, 229036, -20714, -184043], [-69750441, 71327, -603537, 498811, 177392, 1053120], [-1515268, 146720, -2168172, 1279156, 367185, -1064345], [494662, 437368, -5099282, -1230659, 195946, 332207], [14220344, 306307, -2551266, 1480012, -95624, 1085171], [46757410, 105413, -1398943, -1607123, 116427, 471902], [54196339, -150856, 2066437, 247675, 124200, -237235], [-16761545, -365560, -647670, 580836, -119488, 556583], [-22477410, 806177, 238699, 54326, -493847, -1558771], [43247643, -692454, 152863, 945083, 207322, 69331], [-7573476, 437426, -1921006, 83838, -120910, 905340], [22034452, -1279, 952423, 1085818, -225335, 572413], [8404424, 686630, 541696, 1617253, -199070, -962011], [-57919615, -136967, 2919510, -94935, -143488, 519983], [17120164, 349973, -1163975, -551026, 269611, -539481], [65630846, -510346, -1034232, -988748, 15702, 621228], [-49968108, 715772, 3176404, -605838, -40916, -808280], [50798909, -331489, 287033, 167820, 341392, 388665], [13615870, -477924, -1313094, -267410, 498550, 1159364], [19945853, -1038951, 2169155, -809783, 94871, 1424681], [72370460, 337566, 812572, -1641756, 464274, 728250], [-72644360, -5092, -1584983, 1086901, 630195, 1054375], [-2824761, 380322, -1215438, 895478, 251854, 225881], [34747764, -255157, 132027, 64280, -208450, -1883600], [27367357, -524681, 1709653, 2872387, 177842, 342802], [-17625637, 1239661, 1305074, 42416, 295403, 265225], [-55399340, -126010, -2560317, 1184917, -690037, 1444311], [16568623, -79922, 3632513, -1756135, -186100, 212909], [-69301568, -122665, -3721989, 585777, 798610, 566985], [33160594, 120054, 435095, 156868, -274921, 1221190], [57406109, 261404, -5579801, -824301, -437856, 269809], [23430114, -750344, -630691, -620509, -339441, 2823937], [-69137754, -990523, -1540661, 10940, 136525, 243479], [-45368032, -1169686, -191316, 79172, -335797, -703053], [1745086, -545745, 1343435, 425718, 176606, 239058], [149091356, -53540, -117382, 647392, -409566, -1992172], [31149996, 503603, 2480053, 2071826, 202530, 2317936], [-7016437, -125436, -5285439, -1207251, -364670, 813463], [-20170466, -483843, 4757165, -1221267, -245855, 1035824], [3446056, 543754, -1337953, -1655951, -354351, 1346407], [48989947, 832219, -3850967, -1956747, 135481, 1020733], [9325159, -1166625, 1395318, 1146259, -147328, -647463], [9133326, 185028, -4619176, -2817448, 1063712, -426912], [-12561882, -1291185, -1567247, -3144196, 362863, 1461259], [-6834180, -454004, -2383102, -1977616, 871812, -2183706], [-133291659, 380234, -1626088, -882789, 164743, -1652169], [-34295233, -44191, -1910309, 2578434, -468752, 516499], [19089369, -690824, 1185281, 1315337, 90072, -2250391], [25404174, 936895, 2995755, 2230390, 830027, -530557], [-21257683, -1571943, 2336427, -1240135, -210158, -573344], [13132139, -1027094, 1880072, -265140, -81390, 470269], [-97394214, 863741, 1336093, -1251469, 814463, 1251808], [138303893, -955398, 749739, -1700711, -427656, -822685], [5151269, 1068752, -1045439, 3340838, -14482, -1964598], [-4638626, -44317, 3307181, -669124, -34901, 868647], [-132346677, 1530255, 1538588, -1108879, 564050, -206321], [-4938044, -1125258, -3624870, -282208, 219338, 2706690], [-142468738, -124418, -1138026, 180384, 226134, 1634656], [112853048, -1357870, 2757621, -1163863, 310855, 3268219], [-55568148, 698233, 1233833, 1739542, -177383, 2732453], [-9175239, -627892, -5763210, 2206365, -807398, -504774], [-2870632, 563369, 1089689, -501921, 1107371, 1488814], [94706150, 416889, -1879277, 746236, -746990, 3233880], [-80368828, 54232, 4248896, -2371022, -416751, 4096725], [-91652969, -797577, -2575149, 2609857, -837435, 1235563], [-74206015, -757703, -1959671, -2610634, 1024872, 1752237], [-74936065, 605206, 1893495, 738920, -1720814, -1411416], [53675590, 816804, -4482775, -1609280, 1346996, -182483], [238507162, 985332, 90953, -129313, 445179, -439223], [-20520222, -195561, 2852127, -1278829, 792279, 1579436], [83732354, -625472, 904372, -2311560, 424849, -1014087], [96303562, 120900, -4497464, -272054, 327684, 1501826], [19089843, 1752565, 929703, 1927530, -1359358, -3808921], [-15769188, -218890, 6229290, -559864, 433886, 697886], [-84444478, -1994746, 603604, -730572, 1132710, 636344], [69866954, -41132, 1835774, 1790013, 164761, 1825516], [-48927338, -307656, -533184, 2723940, 1254708, 430862], [-43828831, 1487997, -1042429, -742408, -804710, -2436869], [49851068, 50410, -3876042, -618236, -1022410, 784580], [-37988559, 460784, 2503429, 2885045, -264980, 1853971], [-93188112, 299064, -6972368, 274110, -185152, -838826], [136850996, -1955236, -208970, -1336166, -141248, 3348224], [6585590, -1275698, -6550083, 554168, -789465, 3271426], [75156563, -80320, 8989441, -730948, 1358537, -1678953], [113762444, 527754, -3453920, 2600164, -1717698, -3132150], [158536236, 268583, 3744049, -4072354, 1351068, -1788004], [-87585216, -874395, 8462585, 260006, -894377, 494151], [-87242703, 815963, -3022448, -175946, 204285, 3661773], [-138489756, 2007902, 6404725, -486396, 1788557, 2817572], [64084069, -561988, 1552685, -2968920, 67868, -1964578], [-105969108, -1577090, -4191520, 3619606, 799126, -1080268], [60560513, 1335307, -2630947, 998533, 799614, -3775150], [103114386, -16206, -6892719, -183059, -1754517, -1915301], [69852550, 891436, 5826258, -1633340, 421546, -834228], [102367472, -189641, -4356737, -4315580, -400357, 2005587], [45166654, -241132, 7774960, 1178146, -1082974, 1864068], [21660400, 642523, 870709, 3166478, 85004, -2136416], [-105494026, 157670, -200228, 1503820, -2142702, -108112], [-20219959, -437143, -90397, -1051132, 451474, 2424801], [115794790, -617129, -5698538, 1876785, -1464675, -1339597], [112790446, 1554112, -6659716, 1007196, -749542, -1033680], [66177639, -2391705, -2956029, -488296, 99306, 985397], [63499228, 266343, 7181611, -3856792, 878433, 3880601], [-143766884, -25328, -4500438, -2132627, 1172870, 2992051], [187911821, -1776686, -1295519, -724152, -1099982, -2172938], [-102129484, 1132662, 8154814, -4818457, -598043, -349750], [-4488743, -904107, -808648, -1512232, 738010, -1566300], [-110234929, -1428588, -2352451, 2282158, 2295442, 2029508], [-30275200, -1244522, 8271558, -3165536, 215964, 2992230], [72635042, 166408, -2471060, -491660, -143896, 2922418], [-88298600, 562440, 785635, -3715592, -1194873, -161602], [-36878297, -1854940, 698614, -4043557, 1017309, 3995231], [-126908742, -2223226, -3047652, -3300258, -1040785, 283635], [368061500, -137429, 4371650, -883337, -378053, 1215501], [-26413965, 937002, 7522064, 3233945, -1171707, -2737215], [92906338, -2021809, -4214729, -1178568, -722058, 5026820], [-103769905, 135581, 892785, 4098, 3081010, 2647615], [117342229, -729515, 6268763, 31221, -843968, -1437702], [-1700459, 1216171, -7952455, 1628903, 175638, -328392], [-145544146, -80600, 4687426, 5879762, 1227586, -1785954], [-248192972, 1470732, 723016, -1693650, 1664282, 4912520], [-6604750, 116156, -7769694, 2995902, -32740, 2048336], [-5562592, -1130242, -6321117, 1116748, 499379, -2233804], [-9245933, -1157270, -3471167, -6340179, 1251774, -2371903], [-93042753, -1698355, 5784665, -1528930, 1988938, 996823], [49899583, 127333, 1137973, -3268157, -661067, 2280533], [-26622202, -3086555, 908867, -1586412, -2180676, -829860], [9088359, -510522, 10832707, -4617530, -1602424, -3649294], [94088293, -1647230, -1760372, 479385, -1778813, -6542797], [154430677, -1028432, -13622610, 1132405, 1822523, 953843], [31811189, -1619511, -168719, -4746869, 1635766, -1402398], [-242981052, 1001700, -1045900, 3199236, -985194, -1062496], [98132859, -946798, -1623795, -2642511, 2072592, -2396135], [-182212298, 1783461, -1513549, 1870716, -998916, -2408126], [124560202, 347962, 9431359, 511702, 1369705, -3965296], [119840213, -1982619, -27318, 913482, -346417, -656993], [45222770, 1660235, -6080619, -542640, -1773413, -1964257], [-374323048, -1121116, -42931, -3309021, 97775, -2144655], [150693041, -616727, 5243691, -802880, -225356, 3711119], [51753344, 31624, -1033431, 6234519, 549225, 3842695], [171879075, -1071548, -14544799, 1419494, -930664, -1243178], [43077037, -919309, 15820960, -3485928, 3024131, 3044125], [62416445, -100317, -758589, 672538, 390986, -5718251], [-81458426, -795362, 2682049, 4849651, 563015, -3548745], [9026, 1838765, -19715618, -4952570, -249880, 2466225], [182336145, -437170, 7228692, 1408935, 2187947, 3847997], [-232561188, -2406294, 1580438, 542386, -2713260, -157182], [150198068, 1165769, 7115915, 2764401, -2702819, -2547524], [-7359610, 1005220, -705446, -3953188, -1522876, 720414], [81869091, -25635, 12540897, -3125397, -1189080, -3840876], [56003762, 1779520, 1434826, -2198094, 1750092, 6706504], [-48415683, 304325, 4839260, -1770816, 223259, -6032517], [178002319, -434362, -8375372, 2425178, 1932356, 487209], [9251523, 829826, -12118651, 4030359, 489266, -1582463], [-6290348, -1872970, -4694532, -2673686, 19718, 5773660], [-99089926, 782800, -956756, 8735570, 1132718, -3695034], [-287271998, 1540813, 3616031, -3574903, -657481, -1793250], [84538339, 2705207, 1516543, 5675243, 69907, 3341779], [287808379, -2143313, -10773688, -2996411, 807878, 246555], [504919404, 350851, -2340047, 430160, 873936, -1108376], [140213832, 284100, -3509660, -4555646, -2426344, 1699204], [-154222113, -1368504, -1293599, -7205217, -3008160, 251055], [53253152, -2480917, 3105037, 1243708, -326911, 1965009], [82197908, 200338, 2141122, 5834877, -382188, -4313719], [260563250, 3334968, -3156900, 1623173, 1703845, -3056658], [-47926909, 324474, 1620844, 4290623, -27821, -3688681], [-182794496, 2537686, -12347155, 7055817, -1349915, -4520909], [-184186703, -3068570, 2240133, 2192997, -492178, -3049063], [-220384118, -1633105, 9098591, -1527332, -2047530, 2705658], [325682202, -1879002, -5928452, -1021770, -3015250, -3261192], [280149785, 2927553, 1325066, 1040302, 1531050, 4028296], [-75493478, -1214255, 3017681, 1899080, 243851, 1618229], [141235082, -4343127, -12434114, 4390740, 1226883, 2140754], [245878162, -193117, 1021108, -7544984, 1690116, 1847651], [57289177, -1649914, 11509519, -1253245, 1907720, 6730015], [65746440, 3416264, -10807173, 4820378, 2285240, 2818011], [-162574296, 412056, -15176812, -9248786, 826290, -1023368], [-39762042, 1308434, 19176422, 2157852, -3284058, 1018782], [-200503576, 2142539, -3233505, 7917324, -830316, -1493066], [-27878485, 530646, -11537706, 322865, 1233245, 3363005], [15737706, 144967, 7305207, 4454499, 4328433, -3157084], [-75450429, -727243, 13464355, 1472705, -789488, 512128], [-121079914, -3205538, -3404176, 3644346, -1230573, 1877467]];
    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_g();".
// 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_g(:prec:=6)
    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_g();".
// 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_g( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_354_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,6,sign)));
    Vf := Kernel([<5,R![2876741688, 425064268, 16501109, -62240, -8774, -4, 1]>],Snew);
    return Vf;
end function;