
// Make newform 315.8.a.o in Magma, downloaded from the LMFDB on 14 March 2025.
// To make the character of type GrpDrchElt, type "MakeCharacter_315_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_315_8_a_o();".
// 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_315_8_a_o();".
// 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 := [-1253696, 110400, 67464, -276, -570, -3, 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], [-189, -5, 1, 0, 0, 0], [14176, 38320, 524, -496, -5, 1], [22024, 1668, -424, -9, 1, 0], [210112, -55312, -4588, 520, 13, -1]];
    Rf_basisdens := [1, 1, 1, 96, 12, 96];
    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_315_a();"
function MakeCharacter_315_a()
    N := 315;
    order := 1;
    char_gens := [281, 127, 136];
    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_315_a_Hecke(Kf)
    return MakeCharacter_315_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]];
    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 := [[4, -1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [-125, 0, 0, 0, 0, 0], [-343, 0, 0, 0, 0, 0], [689, 49, 18, 0, 0, -1], [154, -31, 14, -6, -1, -2], [-2757, 126, 52, -14, 1, 7], [-2800, -381, 44, 9, -9, -8], [-2152, 1236, -2, 51, -44, 0], [8631, -3564, 384, 36, -43, -7], [-82821, -3221, -268, -5, -72, 21], [18325, -6084, 996, 56, 97, 49], [123835, -2840, 918, -357, -99, 77], [46338, 1196, 1382, 63, -164, 112], [-20760, 14722, 1190, 133, -388, 98], [491219, -14583, 2450, -196, 532, -301], [-190050, -63764, 820, -126, -594, -406], [-7353, -71688, 2792, -1068, -241, 703], [684367, -76772, -3896, 1540, 297, -371], [170978, -27265, -6910, -216, 1889, 294], [1088204, -208241, -398, -1330, 819, -492], [-29393, -1908, -5466, 2891, -2573, -441], [-2317735, -11670, -19402, -2415, -3305, -651], [1027600, 28396, -10504, -532, 4014, -1414], [-3470518, -37931, 958, 1742, -6425, 3490], [3247853, 285952, -44810, 707, -889, 287], [-1728102, 296652, -16224, 7140, -6202, 5386], [3276436, 140986, -10982, 10251, 2062, 2820], [-2708713, -183026, -5806, -3941, 3203, 3101], [9336915, 105117, 23994, -4576, 6564, 231], [-185731, -726436, 50, -3479, -2223, -16891], [1634762, 563126, -48756, 13216, -20016, -1302], [6677521, 690479, -105806, 598, -23460, 8165], [-4848480, 1484827, -60628, 3197, 16067, 5284], [27895903, -807102, 106204, -20724, -13373, 3193], [905881, -509500, 76002, -11291, -4107, -11319], [-18014542, 627823, 162754, -27550, 8629, 3278], [-1900412, 2372000, 146770, 41545, -46478, 1554], [39393169, -1568748, 50792, 35028, 14935, -8141], [20917858, 3054066, -240488, -25606, 23502, -8820], [4218023, 1410369, -388114, -24990, 27818, 29713], [-5427125, 4931570, -167208, -31806, -7807, 20231], [56117844, 2859465, 32450, 18454, -45439, 11564], [11446340, 1601762, 227264, 9086, 6804, 14098], [35676285, -1186133, -392894, -8214, -37412, -42551], [-45374199, 5267275, -161952, -18179, 29274, -33537], [20128121, 5382766, 372306, 21651, -46493, -931], [28590848, -299330, 762196, -26788, 31114, -26212], [42705971, -4338146, -583654, -22337, 81065, -51709], [-121517939, 563816, -467484, -82374, -58711, 14793], [8145649, 3983677, 880034, -47484, -28774, 10413], [16317660, 1743571, -618, 185354, -108389, 77940], [-47722100, 3262, 838884, 48796, -36308, -49986], [-40804842, -10230020, 131684, 23758, -119698, 52290], [6265013, -12362632, 570348, -18984, 47077, -29575], [-8593698, 12293218, 483458, -14741, 40816, 1238], [-68273667, 1966156, -578454, -159551, 34547, -35553], [157545055, -3159143, 136296, -187825, 149598, 78061], [91931393, 8416938, -695960, 8932, -246613, 174349], [95708768, -11722514, 1210088, 17918, -76830, 105652], [-30226604, 5873088, 880768, 30688, 116256, 139552], [134207204, 7895052, 2879284, 133126, -153694, -137802], [7392854, 10552150, -1484296, -202742, -368948, 19774], [-22264466, -16735962, 1082000, -355978, 202316, 107982], [-172107618, -3403475, -2165938, 636534, -174625, -137070], [81358071, 8958713, 1858614, 5094, -336516, 382011], [-239679297, 13320586, 662998, 80185, -467779, -127253], [159311474, 22633290, 1702676, 198072, 298842, -262416], [-449441712, -15679084, 433706, -184791, -279568, 326812], [-68669, 17339496, 3133988, -91150, 733239, -197577], [-243905827, 23697640, -207624, -270270, 245341, -454167], [-195066846, -29603819, 1864282, -41350, -193969, -288314], [16308400, 73237846, -917812, -281480, 162802, 128764], [-184200965, 21885900, -610140, -1060780, 207615, -139545], [-61788983, 35211436, 3603398, 204995, -311715, 124145], [-254567339, 44261404, 3797208, -363860, 140359, -469301], [240822895, -58097438, -354256, -381690, 559651, -205063], [171422656, 534981, -1357770, 30174, 499985, 254500], [287682342, -48875416, 4929344, 463688, -461938, 950], [-115545658, 76314152, 2748044, -165914, -982884, -409468], [185251352, -52063912, 1939736, 780948, -252036, 195636], [-1184502038, 63888768, 3682592, -327404, 275284, -421092], [913410302, -61574077, -3459222, 1135920, -69127, 4554], [-696871976, 94683645, -2614826, -927262, 77861, 71912], [-21935519, 37307175, -720388, -832501, -745614, 436307], [332854582, 103706992, 4138270, -684641, 8098, -6126], [882820092, 93494624, -6212924, -96366, -222736, 710992], [600090202, 8630336, -3787484, -199514, 504216, -124768], [850319586, -61256216, 424096, 604856, -179244, 615244], [-118763481, 3203116, 2415026, -860839, -3825, -1183805], [1168876605, -46883414, 2225370, -918309, 82115, -493199], [1017439052, 77183514, 3376588, 1352288, -1558538, -684908], [873094425, -197498496, -5139822, 428757, -1038071, 246393], [1007618323, -36013623, -10148426, -30466, -1207890, 424941], [455593225, -50598624, -12356338, 1645203, -176415, 1255905], [54239753, 33774860, -9283060, -2274258, 984815, 136787], [834286825, 76209404, 4295006, 605619, 1031795, 1777727], [1940631729, -92075460, -5476082, -1290233, -351153, 531811], [-840949924, -118926238, -16338828, 1601012, -1321278, 1205544], [-1296107376, -119032812, 1343568, -450492, -1470926, 1917678], [1362051727, -7889668, -2788784, -3905160, 2467953, -744779], [2446770823, -741675, -3686954, 486458, -627088, -961069], [1961935332, 165386804, 2517632, 799596, -211892, 600152], [434789070, 91011436, -17876448, -1813340, 1378458, -1434274], [637340503, -232315070, -8165902, 3067351, -1081687, 1341711], [2008831226, -76172415, -7470570, 2213270, -874177, -1531714], [327212312, 19007728, -11725552, -2205728, -548348, 65156], [2220719577, -132670600, 7291284, -2223228, -502827, -1723911], [2877977168, -48692211, -6262126, -188918, -1322543, -1234216], [-2906260568, 17913398, -1152416, -2199430, 875128, -2283454], [3932059330, -96081354, -13880792, 1255430, -1951580, 1033790], [2098265923, -507562450, 11067768, -391524, -2698515, 1706915], [3557544175, 97418213, -16955050, -495566, -348928, 424979], [1112538920, 132516915, -9862536, -4174257, 2868239, -594592], [-1252527097, -109579532, 14724326, -1272481, 2270123, 858991], [1205610300, 242615046, 3745660, -3577552, -4145086, 2788668], [2238894190, 217208710, 4875252, 1766144, -2744464, -1821118], [5795281617, -181078028, 10354900, 1382458, 2328811, 1520743], [-2256703623, 111991999, -14711526, 1495090, 113496, 1803057], [5919644999, 58421463, -7439878, -1219450, 4123232, 1212041], [-1010671779, 127483528, 39951444, 1767730, -98139, 2039877], [-1111255520, 349702516, 16146452, 4079558, -5380794, 161602], [-551853630, 10108464, 2838060, 8987314, -2908480, 957544], [4015424092, 40047764, 12153834, 3073657, -1056180, 5306744], [-4527717862, -169244203, 41087760, -2750687, 1255095, -881450], [6761415821, 66530748, 7343252, -2683530, 1748491, -2684809], [369563862, 221601760, -258008, -3267096, 2279548, -3437084], [-2422170216, 433923152, 34177596, 1714622, -7220252, 3131380], [4715989208, 349981862, 19738968, 1763174, 1772778, -5685324], [-222119014, -540996995, 13557814, -7561082, 1927475, -410690], [2424414211, -430025374, -54244218, 2398193, -1049455, 1001175], [446397224, -90597522, -44208042, -981047, -5291422, -735348], [-3863217033, -573145234, 64029410, 1490839, -3312039, -3531493], [-1760300811, 67327038, -63456152, -2961112, -2304153, 4585189], [-5819696934, 42993800, 40465496, -8756580, 5292192, -3452232], [-1668085352, -234927150, -19277580, -9625200, 58104, -2644522], [2183477432, -76041358, -47406376, 12770366, -5855008, 3940118], [7384612962, -128840178, 37059516, -13123220, 6078000, 1597850], [-6120682280, -331742682, 43466508, -3633056, 6236152, 790258], [4237051656, -152451886, 41801580, -2955580, 6452934, -6673500], [-9378108122, -51989961, 30463536, 3318003, -5199491, 4392498], [-2378939161, 355466796, 35420108, -7125950, 3558981, 4458929], [5194673153, -91247820, -21525186, 4572743, -10124375, 5056485], [6225308674, -507980434, 25949270, -11082843, -995440, -5656158], [3126300021, -678487922, -41029680, 6582082, -6170741, -2695547], [-3058247914, 444716782, 50576076, -390068, 858032, 5688970], [4864738404, 352270029, -374914, -5744062, 7587869, 9110968], [3585431983, 520095830, -44186676, 4719022, -10149015, -1796921], [450043090, -351791335, -30795724, 12642647, 5012067, 1539534], [2192458406, -368891300, 91184342, -662313, -3094594, 13125778], [6583099079, -107914794, -52250212, -1270150, -3927627, 3313611], [-2057253376, 897250116, 104904784, 2095408, -7688278, -5479810], [8874922957, -1099948040, 9010524, 1629418, 5624699, -507997], [-6667217828, -328159142, 74069530, -5365017, -469676, -6633662], [1869890553, 477692996, -50257196, -15569078, 84603, 3865911], [13204868768, 900048645, -64307230, 12386466, -4968447, -2291744], [7417252027, 882803502, 27853042, -4292393, -15548435, 9860095], [-5369989990, 894103100, -34775112, 13354488, 5584036, 13616232], [-432989116, -293491773, -81205166, 6509466, 3049811, 6671872], [2981349608, 720041992, 42846520, -8518804, 19574674, -1848854], [3310474936, -209485200, 119440878, 19451015, -9641908, -3600436], [25393208817, 347557593, -46832930, -975622, 4836934, 6050053], [377548298, -518676604, -83211308, -2450042, 4281806, -16340198], [-3444513094, -446119458, 18767636, -3436944, 7054080, -14235046], [-744785229, -805331679, -68285298, -24461354, 6944792, 4448727], [9866614666, 26079910, -117166618, -5111799, -3711286, -2509108], [-9633339233, 256888706, 1029018, -2646665, 17137373, -12145189], [16940235768, 114983981, -33412354, 23583986, -12824055, -4748540], [2987595929, 303030410, 9409414, -12862227, -19976871, 3894863], [-21082463890, -1160360776, -75656084, 22523522, -5929284, -3204180], [-7521826455, 560119549, -142897926, -22928280, -718028, 517447], [-875115473, 618064294, 70037340, -21253184, 6965225, 4422395], [-10374534576, -631296041, 93047578, -5117216, -12419877, 3432768], [-4282363410, 2401889872, 64894356, -1114330, -16842856, -4022592], [13543513145, 692213277, 81088432, 13026527, 1459756, 12039207], [-15604875795, 93404400, 7280778, 19403181, -16799653, -7124845], [-32904059727, 38062444, -133852334, 2539313, 12617801, -5328883], [10099239395, 563940558, -104993688, 25456470, -2028541, -20743699], [2547882152, 1643075282, 38461304, 25829866, -16384458, 9189364], [2577426789, 2263810814, 69825476, 7823828, -20022693, 2882709], [13420010112, 1785885412, 41323964, -8518454, 21843408, -8816724], [-16265219272, 625988942, 82723512, -22170946, 8267110, 13806520], [5200397713, 695101544, 58857968, -14281778, 11681649, 9770733], [-1392124827, -930079466, 13879064, -19688284, 12780275, 4652193], [13445098312, -485044790, 101112046, 6347113, 32763770, -9196984], [27426362529, 772609064, -196583502, -19631255, 16501615, 2616159], [8577194537, 1774166120, 25979036, -4354168, 28032345, -15308195], [-700536698, 621668346, -363456464, -34381614, 30181684, 2188258], [4450281933, 2243027878, 5167294, -13867875, -1001831, -15262317], [814904120, -890314508, -255158388, -28188902, 1191632, 1356684], [5898177402, -770974971, 22061894, -50469886, 42370767, -20362726], [15739678048, 367151974, -187788830, -22657405, -22123282, -3434440], [-7062862133, 3061710008, 68410722, -24395259, -6683821, 20301323], [14894291910, 407279980, 45099504, 16190300, -4217300, 3898272], [7115269814, -1462079008, -64607838, 36260897, -11094462, 14897218], [22281901713, 1204818496, 90359932, -20175624, 6153781, -9962463], [-9108053533, 3184028318, 178952126, -29349411, 6395391, 16334017], [-20961690553, 1670320592, -114833504, 20496210, -39097469, -22582833], [7925690339, -2772887376, -65622632, 30248134, -6809877, 8961463], [-22902033821, 3085374500, 133955208, -12465404, 18066365, 16985465], [636518587, 2299571364, 158151616, 23724628, -32007483, 15807161], [-11707999515, -407005717, -224804680, 28941297, 6110902, -10649621], [8318191288, 2475770543, -154482110, 19226742, 16858363, -684244], [11539425276, -3465436654, -120346848, -11790962, 29294700, 10000410], [-41104455116, -353927318, 19035296, 15395898, 38556310, -13006924], [26846297798, -4412909942, -8187708, 10657556, -3615338, -23222668], [-14599363273, -843903651, -33296972, -28120903, 7782858, -6201179], [-83287998828, 2657043994, 146022106, 18263699, -10888786, -4218028], [18880286524, 2663176598, -224053656, 15886174, -16855590, 187316], [46597139232, -1962523135, 461519808, 44206861, -46931527, 36304156], [840016698, 1369618194, 319008376, 2187878, 19565754, 25351088], [-50593215665, 223036324, 280383550, -13167861, 21628805, 4419289], [39759324292, -2151052296, 472284400, 16903096, -46297332, 15898596], [-45129541155, -1937559218, 206004734, 7839825, -39137409, -15193703], [-34088227242, 2998689830, 229990140, 1267196, -14861552, 37579346], [-3630047426, -3973965194, 89683016, 599326, -13038550, -24143580], [-30914972061, 1892124360, -379076082, -32501469, -1870589, 5136747], [24588307546, -1671643064, 64099184, 5236672, -24490596, -16699676], [-55310560334, -2773711538, -268391062, 6052371, 48880360, -12120670], [-12599977761, 4683910943, -222856338, 3033636, 42781294, 13752167], [67336969894, -47636016, 363484040, -47264, -39698116, -38368092], [-21611780159, -2977447041, -263867804, 14245923, 51689702, -18155001], [-76609372162, 3233941750, -129038672, 37718258, 2284712, 2276882], [-27871169148, 3492786960, -307369260, -98280910, 14378808, 18978456], [-62614248800, -8545057076, 378337308, -12912158, 4936656, 733796], [-16967395041, -4117577862, -115011754, -96515671, 50766259, 3277393], [-29325266311, 4832918200, -85993628, 62480124, -695759, 31313205], [-42638716728, 4530386585, 208409942, 15867776, -12329339, 67929792], [-8868773692, -4936326008, 492661804, -58604474, 40156100, 46518220], [-82794091097, -3480993527, -396539658, -11902098, 19253554, 39437073], [50632853345, 592143586, 661731340, 54232794, -11482413, -12072011], [-60548185944, -3815061961, 463604132, -32177375, -14638261, -27694952], [45823393379, 965142188, -75401754, -21735581, 19536895, -4140605], [-20590361864, -692636682, 443275720, -27972858, -54349130, -5506848], [43613166282, 606063942, 387241840, -27581682, -13415624, 42075242], [11798559308, -6449887282, 77037014, -9599135, -77699320, 33405442], [-49825244628, 1188719268, -70147688, 3123656, -8470018, 9153994], [-22067048625, 2427093663, 569835102, -116965932, 47748490, -39670221], [-52555864905, 469511293, 364055262, -7768242, 47072150, -22339551], [-76975065108, 4031261300, -165013224, 4950848, -45176480, -30388484], [-22067819686, 3725002182, -106037558, 34725871, 16543536, -44147238], [62674277594, -1940586793, 90091724, -109490699, 37303325, 11914170], [-19215266584, -4299677156, -270548472, -10266928, 133487676, -63933328], [-48228139241, 7748794018, 111008102, 142841181, 26961595, 26125785], [-89118127661, -4174083850, 216769080, -73440416, 27455041, 31619959], [-3613484660, -1947732826, 493141836, -104254780, 10270682, -110515412], [-46307051982, 4307825186, 456297140, -4149896, 83988256, -785378], [-54685088234, -1590802140, 118817100, 78264102, 50708566, 614362], [-83311949083, 560890072, -463229986, 3036411, -53897227, -22501619], [-55062625524, -1587937560, 154139178, -59383651, 28693040, -7009672], [7872861009, -659715116, 142931440, -122396974, 67295945, -90376615], [40882796942, 1381914652, 329453848, 168233688, -50121284, 41616512], [-35127755164, -7440106348, 309055766, 73638559, -25259564, -15675168], [-44206115698, 4508262836, -272102240, 98862764, -67821516, 57903168], [49618988230, 2052333190, 121226148, 27944, 47636978, -1888012], [-43955826733, 8543896309, -45680718, 66487328, -56579878, -25495251], [48464283881, -4738791202, -785543366, -49997745, 14732717, -59205881], [29596790498, -8003966112, 915477588, 20042098, -99741466, -53079802], [-5055159570, -11073821062, -332551228, 92747620, -99239106, 74414956], [-40616208388, -7356202059, -44009802, 62134610, -72662407, -14184524], [74184324615, -7378139704, -156064006, 41895217, -62762461, 70930363], [15819233630, 5851563392, 79319510, -145871149, 33282498, 22108786], [-52406128505, -3778724384, 256019684, -170997678, 14658607, 34758439], [-24148785354, 2372177015, -248533342, 36628286, -54908527, -9451094], [-7721710357, -3606101356, -826175620, 12726056, 34819735, 62789671], [37407164436, -8601769375, 246208588, 115770891, -72292715, 10634440], [56339515125, 2985929196, -295189628, -46425394, -7596665, -96306973], [75431020321, 8708522132, -96993978, 22423163, 96714319, -53042101], [106882190971, 7380504744, 39073172, 48272910, -38154747, -31999779], [102407867387, 1457030235, -223613974, 30879430, 29995594, -67838137], [238916872679, -942584438, 445645044, 87601056, -54158227, 37663531], [-2925352374, -11722963772, 89124026, 60924409, 5378768, 46098556], [-65893785092, -2659332343, -986526938, -34877898, 105223649, 41451208], [-12381081761, -2330260278, 759379610, -153802397, 111053981, -461573], [-77773473012, -120811735, 383021966, -19063758, 179535993, -36281584], [125646197614, -11152541282, -1218875276, -30551220, 44094288, -30877134], [21892210692, -5942326878, 72334874, -187451653, 156017334, 4993844], [20362905078, -16020218160, 1031132856, 62224792, -118643284, 81996852], [62388991634, 7050874164, -548450200, 7827176, -90450136, -5895932], [14952850984, -1018893568, -454091624, -197030456, 80389372, -59390268], [-41866913254, -3474987742, -389607050, 65403037, 24638550, -61638388], [-23919335409, -9427099216, -807743570, 207608891, -157047601, 65872863], [124966946786, -16978534706, 634062202, -56329917, -138536210, -1867656], [100277085609, -1129773606, -729494212, -321413468, 211780707, -55050911], [-528405666, -14090820006, 66898568, 62034022, 132030044, 273498], [23348617862, 679616689, 671972490, 212208854, -270928921, 122235714], [13553059384, -20581094044, 394357632, -73122112, 24088210, 43812230], [-87412556941, 2996642117, 700528794, 38259076, -152312064, -97607997], [6593787983, 6437411127, 456617572, 167044607, -188747064, 15783817], [172348891698, 10633656832, 10686248, -83297732, 152871088, 107144912], [77369549001, 4959954948, -434225316, -218823662, 152033267, -53916105], [48989281399, -12895332166, -153550570, -93438191, 232756193, 28881279], [146155908467, -10520236059, 1159976206, 44913066, -83607316, 45580439], [-77463902150, 14873529520, 1616095292, -280378126, 123946758, -173064290], [36997401007, 7066790232, -428299792, 41507074, 129167059, 58341143], [-60459804992, 344091040, -573548104, -152400444, 17621158, 48755014], [77146308647, -2585310091, -1435134540, -161268799, -125401886, -4057307], [138532537386, 1506919020, 6234396, 48346998, -272565392, 116168556], [-45188880280, 23760358280, -288716000, 73161536, -54070028, 93622956], [-38125601592, 15204583666, 1375450216, 32359566, -8879550, -8314280], [20029560608, -981598617, 292869354, 115528850, -270743077, -20407164], [229074657853, -2102406417, 780820626, -137186626, -21957492, -25017003], [-182147487471, -10753057882, -500228498, -91278719, 63166355, 212481605], [-187836898724, -1271621188, -391896642, 375858139, -158619124, 20157168], [25105104293, 19997949574, -133588530, 92788521, 5922315, 126034125], [-92259343498, 10843299782, -449634376, -104578614, -1938786, -28158032], [-146871330582, 1137480686, -1535255870, 86191307, 47504248, -41479798], [-87330467549, 27626398956, -573412276, 7286602, 98752303, 1884411], [93499802874, 1211197087, 824760562, -92756248, 257586753, 38631798], [74270836343, 14116686350, 41546156, 61757402, 189538209, 55929503], [27334454296, -5398274822, -2170437734, -130166505, 136942996, 88688418], [167706895341, 1554064176, 1094235892, 134487794, -61880497, -126610745], [101441812026, -17398418916, -915586800, 139039396, -28984794, -64708694], [49546703353, -397750352, 691507228, -193934342, -49687905, 58864575], [-228835900764, -4443859560, 528242066, -61194231, 12968480, -7088568], [-219702889580, -10906052546, -1134110112, 157063762, 37298168, -121483334], [-130570721180, 1809086890, -498637792, 217501522, -284347226, 169551956], [-44096158566, 14130836053, 769731390, 25563196, 310814839, -111691794], [123446130298, 13096234193, 693711142, 35146926, 136636931, -181317838], [-98849233570, 12556216072, 1253406812, -220870002, 37311242, 227948034], [35708604302, 5262831621, -350054036, 8349367, 205707483, -118691654], [-197169889006, 19901836316, 1082227856, 52880716, -103500432, 11779796], [-20064366068, 36177530560, -635851176, -107863196, 213295042, -103041694], [168683123974, 6850110820, 858897412, -105979146, -94771814, 73959382], [40669475165, 11856993203, -807238282, 13265852, 217647348, 122515881], [183881800754, -13136992350, 963845048, -131833494, 258593918, 19730796], [-307173237799, 4751751726, -73940938, -182064547, -220737945, -146271055], [248700616478, -667840176, 1959777912, -284121900, 191120054, 43071878], [-260931467284, 16831351060, -526184258, 131498115, 53117372, -115002584], [-52060245997, -22715700671, 486525470, -225704022, 230963444, -138965797], [-101768671741, 37266254394, 62263018, 86424247, 26180659, 798553], [336069950391, -2328409281, 2232765494, -211885744, 54993526, 211921183], [-218833737225, 37826682281, -655403388, -23497647, 129640642, -48814071], [-238625581790, 4286358016, 2596424568, 144881884, -56238134, 113016218], [51426609125, -23641410644, 919734218, -398608875, -59524731, 121152633], [-76353514802, -29966434128, -3010734904, 386019620, -110357618, 222923918], [-163544731084, 2856634164, -959189816, 96031264, -297203826, -54892502], [438020971845, -7083915340, -432129784, -82757234, -2029043, -93692851], [81349124474, 24675596422, 689115876, 541009700, -405128850, -33378200], [235391557756, -5403877114, 425200128, 557967290, 29031934, 98834088], [43979909889, -1804991872, -1116601080, 255317762, -321824719, -54412043], [91651238447, 9309632421, 3256231454, 249732062, 132384176, -148359181], [478279848067, -24726327324, -97705094, 94526257, 119098341, -146780375], [-109347161651, 9828619868, -631320622, 402867633, -311471567, 2579941], [262568426157, 10114544323, -1269772170, 101077372, -125109828, -60147343], [-561061801355, 23853372411, 635173826, 141337538, 183033614, -22809029], [178871986653, -11482029052, -444297332, -67717742, 64469413, 246129801], [60130420591, 29446283068, 584851788, 193093838, 139382317, -9490271], [-180582920268, 35429523648, 1282792784, -85038184, 236386980, -155720572], [483073464340, 9101063780, 1593695692, -336590310, -413816830, 125122046], [-44605882160, -20873767849, -499408080, 335857579, -322285937, -143324604], [230514529262, -32570439370, 142809932, 35879424, 64946982, 162819104], [-55073016825, -26053883744, 280848068, 39576570, -186595967, 310649], [148219872362, -21787611704, 1060272180, 86541034, -329389150, -62272870], [-317486428919, 30881699702, -881124170, -320100207, 96101753, 190090131], [228691251373, 6735619292, -3289796024, -222723242, 150381153, -7730919], [437992374342, 19524042964, -152324128, 444729348, -252627698, 235556314], [-401308377808, -22215881682, 2245091072, -151270770, 187216998, -196748944], [323116744101, 24254781365, -1130503402, -346833066, 335972510, -72712327], [-548423116562, -30347797934, 2511590926, -394905415, 344454504, 7646318], [375294835789, -10573268180, 1235198648, -452405674, 338491329, -40995927], [648491950375, -8554985384, -708679718, 220355961, -64133595, -68476163], [159342486302, -32291079614, -578918554, 465743357, -302825784, 344641070], [-18242197373, -9714786137, -2189052734, -793969478, 598756292, -211625795], [2053249618, -21790408626, -3966135500, 273037416, -213364096, 29541898], [-52345348520, 39833349036, 537902128, -167586720, -122973630, 259162190], [387838241520, -28763319316, -1358572008, 96541060, -4466738, 256579386], [193727536336, -15583260408, -1360835188, 156123702, 160671228, -244622364], [-36212732704, -36880040492, 69550344, 248248000, 138470826, -1240218], [-268803160819, 23787222937, -3232248122, -160386230, 74479668, -185781221], [-198379191472, -23514414143, 564116944, -199971299, -128359151, 286523588], [-91863120610, 7835054682, -3492536394, -159234603, 339998760, 60836230], [-10781735435, 9497357190, 2550403460, 817312316, -122040823, -54360309], [-138920550501, -25787731115, 1397839984, 41992983, 168836622, -370742111], [181336163055, 3828635430, -2290117700, 64462650, 127937237, -177126341], [-378100819002, -30209975278, -2718636180, -172814348, -406744224, 364768222], [-538183624478, -25101679107, -3723592946, 726909220, -190976417, -20650978], [318141892712, -26481798843, 3452824598, 156971714, -593322587, 487005296], [816627705341, 18651675396, 1542483766, -601276893, 415909339, -31741465], [3254593186, 21975982575, -4743609726, -417390442, -125304459, 88850822], [-135752054821, 32680224592, -713283938, 68919039, -365524583, 573246625], [54545366571, 22986244265, -753021358, 400112736, -322070016, -255069193], [265627415217, -27287635920, 1375146370, -134874355, -304309791, 145818113], [333560254553, -40705831201, -1543613858, -317801520, -188692132, -14237859], [-548377048216, 227731123, -1728937468, 331614881, -248086037, 199569236], [-423679506815, 49324272512, -1721287888, -532584892, 113942967, 287856919], [-244597876857, 24752978066, 6917430634, -127297653, 548009037, 107239699], [620690230250, 6345190705, -2451093866, -399413062, 534496927, 17462374], [805666393741, 4730339908, 1754290468, 96031418, 227252431, -603626373], [196193517976, -9452426330, -4199277878, -361617837, -229655572, 201163214], [-234701382273, 15692084766, 505188662, 803545953, -675150449, 365936417], [328739179516, 9761962090, -2924763448, 457788702, -124019624, -351554602], [574247173839, -8112428769, 3297415226, -231177194, 121091848, -84543271], [-237216013462, 14262971866, 3963336472, 114812478, -223773932, -323899214], [-233010570322, -56240718073, -2765358662, 128536892, -372036939, 287595186], [190326506038, 14183403350, -1239683424, -435813098, 919069678, -268326464], [-139948578257, -65967421551, 2361755224, -183101821, -142018198, -18205431], [178327161452, -24840686200, 2638958440, -264779424, -420655454, 606332706], [-59813649815, 48937111454, 1993218938, -863316153, 226290707, 394727389], [659202363127, -12831331448, 2280851372, 185086438, 178396101, 95542069], [218346752217, -14066078214, -2870528956, 214732512, -481248237, -736493919], [518172364585, 36812215853, 545927902, 482754494, 408847602, -271605075], [-42123038638, 56780661428, -2984855336, -667648520, -342590550, 287323750], [461144170017, 42571768178, 859884764, -63017122, 45085579, -315523355], [497381608376, 27896543708, -248117632, 391771380, 210820686, 100130114], [237393821523, 8478777561, -1155139992, 480526515, -250326090, -565531955], [1177504019091, 31808034278, 2389636612, 205573326, -169989031, -476221697], [-214160839244, -64883022368, 1091658892, -395162466, 146530376, 572526200], [97549387824, -24398701644, -1274899836, 596668782, -257727872, 145033036], [-336380423954, -31407729204, -1399100252, 727405266, -122247858, -105021350], [399018034636, 4779456327, 905181578, -186304966, 916207615, -578233640], [-121272231337, 71439013977, 2473834498, -498749644, 294769364, -55972765], [-583709370034, 41050734964, 2029618806, -731309809, -236575074, -131202566], [-138482152955, -2072418598, -1529037938, -337795003, 969726775, -566732635], [160412313786, 62898896716, 340007868, 1503299910, -440976608, 22844444], [400415032939, -71618367056, -2333534934, -699304459, -953550983, 39992449], [-503128271276, 2774924671, 4479212974, -669354654, 49104023, -111738092], [599338547114, -33072735858, -2549192700, -65350052, 544725340, 157650590], [242445688797, -64740748026, -1173148076, 809409622, -482915385, 442562029], [-68268573074, -16318104882, 85981870, -1123676379, 715048938, 275354436], [-136710811797, -27546009438, -6063377704, 885461050, -182005353, -557075027], [-539898470796, -34389063715, -4404833002, 147330506, 380308277, 39744184], [-1404182296614, 44812570774, 4805532138, 104195531, -166054804, 285477150], [9067597352, -91963924358, -300253640, 45448270, 205476330, 312769800], [118348917658, -12013820763, -3379653170, -243160802, -789838221, -36594962], [-170360484998, 53116459524, -1664770112, 96338620, 913795096, 529540564], [-409646773326, 19834335102, 1663223906, 112371139, -158585048, -348529958], [-202437088166, -18508888892, 1770071124, -1887636970, 872837842, -458866018], [-109956929090, -77245280347, -2998663980, 41221047, 393493695, 349981430], [-1108764537150, -66235479690, -311580724, 469236180, 691125700, -301625002]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_315_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_315_8_a_o();".
// 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_315_8_a_o(:prec:=6)
    chi := MakeCharacter_315_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_315_8_a_o();".
// 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_315_8_a_o( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_315_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,8,sign)));
    Vf := Kernel([<2,R![104768, -493248, 11352, 8596, -390, -21, 1]>],Snew);
    return Vf;
end function;