
// Make newform 342.10.a.i in Magma, downloaded from the LMFDB on 04 June 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_342_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_342_10_a_i();".
// 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_342_10_a_i();".
// 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 := [2105804, -155839, -8016, -2, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0], [-194644, -14774, -14, 2], [199772, -9131, -113, 2], [-407860, 34894, 226, -4]];
    Rf_basisdens := [1, 693, 693, 693];
    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_342_a();"
function MakeCharacter_342_a()
    N := 342;
    order := 1;
    char_gens := [191, 325];
    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_342_a_Hecke(Kf)
    return MakeCharacter_342_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 := 10;
    raw_aps := [[-16, 0, 0, 0], [0, 0, 0, 0], [-216, 1, -1, -1], [673, 11, 10, 1], [-29846, -75, 23, 23], [-1651, 72, 155, -48], [-170059, -806, 622, -164], [-130321, 0, 0, 0], [-729397, -2860, 2261, 286], [-2072045, 1462, 305, 2317], [855664, -11406, 3206, 1575], [-228986, 44790, 12018, -2407], [-2101228, 54606, 7652, -6677], [3458496, -33371, -19729, -12765], [9047560, -72357, 30159, -26833], [28597991, 211304, 5495, 5549], [99109745, -167393, -65165, 23037], [-74458258, 179517, -18145, -40083], [-28380817, 14227, -378155, -58278], [-1077814, 174182, 401084, -94124], [33829153, -440920, -324108, -55158], [16738958, -149796, 126264, 39373], [-344163230, -73852, 333322, 59700], [-389764840, -924050, -534350, -16075], [243849830, -209434, 273586, -183388], [264245814, -2082044, 517008, -976246], [-315255662, 375272, -2341388, 238154], [-214415377, 674597, 1457093, 1181955], [-305419209, 328608, 171823, -1105009], [-315926338, 6809444, 2809298, 647677], [422306138, 5463154, 1079950, 2055599], [-2713913472, 2425113, 3396475, -903487], [-294683767, 2334906, 4136158, 1322934], [-965419132, -9237647, 5626799, 578447], [3372324232, -7820539, 3237981, -2138173], [3062223354, 3748508, -5791464, -1640936], [364126658, -14799346, -6625760, -719546], [5069142388, -9306914, 11965552, 2861308], [-4676296856, 3872750, -28963764, -3421939], [-2031693294, 32744034, -19621880, -8336256], [-2362355108, 37215158, -2887324, 9803859], [522318266, -35025010, 35439872, -4727128], [4777765179, -21830503, 37374058, -2470855], [5267543410, -42438880, 12521388, -681197], [4717165896, 32071666, 10253202, 8475118], [5192711277, -2134861, 52230646, 1191555], [23297099667, -41511291, 56058045, 7236959], [25116936010, -29725592, -35710562, -2009259], [19733920041, -89183479, 46556017, 5069223], [1568545626, 39543299, -15865367, 35602917], [47892353214, 36091065, -59021591, 20986409], [-9726330285, 9091173, 98607830, -10651647], [55609319460, -24818654, -38113096, 3482625], [-47537554242, -197586599, 70323005, -11913709], [12582608564, -7278202, 155028596, 6290004], [44823218472, 3570483, 33205983, -38656359], [28523948498, -241507628, -115549396, 546961], [15517443045, 160081756, 44893839, 37072480], [-17827091920, -41718883, -29130989, -11073327], [-16447977312, 42641978, -117734690, -25025622], [46245576502, -228121237, 142176349, 38135787], [92627555269, 125441084, -26554321, 2924978], [51767518488, -347449824, -71495190, 63723861], [-52450803933, -27266533, 326143592, 28475299], [-62861450451, -28347337, -141104565, 26575713], [62093129265, -248245326, -100000511, -83559902], [102547210213, 41837989, 479491603, 98069192], [150195640164, 580026334, -140162272, -6615978], [151201088130, 584681717, 46306329, 31083031], [250871681686, -367083069, -52618147, -174696161], [173519819503, -696836539, 55275141, -189984953], [-251409041755, -75237347, 313951440, -64013497], [112900426332, 1218927676, 487540812, 133845068], [-96459511289, -404840108, -188211059, 12210278], [-35174844761, 567827981, 763490277, 64101873], [253113687750, 1098153746, 74647592, -120835877], [-226026622730, -1590786655, 336273585, 159999125], [236433409756, -870933227, 1303413099, -65849983], [-317988317892, -643160236, 565566550, 205374049], [-434073039676, -268510846, 248756102, 210834921], [318472801748, -464885906, -15682856, -255756612], [-360235550035, 1193754672, 261145489, -357647069], [355393675630, 482203184, 631679046, 129832430], [-185376904442, 805042618, 310251582, 74205775], [-785822168, -976298606, -658524004, 305904395], [-119221324258, 393563643, 1312943793, 196222961], [-13352969478, -1326769480, -270323054, -584509954], [78622610113, 2248301410, -404040370, -609046730], [319064715092, 2030631833, 737795497, 321509785], [-296785038820, 2076722081, 1502071873, 265472209], [-818277168566, 1463393833, -1338081599, -32139221], [596732036068, -1210166624, 637014504, 665414680], [83443655486, -1019776948, 825126124, 509173966], [446941694212, 1226291568, -192370668, -331719710], [-400952538508, 1274744699, 1953094821, -65261325], [-215819933349, -1486790136, -1309338715, 288952524], [-640870529510, -2125495348, -1183340110, -618641818], [-551381812464, -1978257944, 2263267594, 558870235], [-980514689691, -3520553461, -116667005, -45261901], [-392471573278, 5756025363, -199643025, 585525423], [850088375508, -4475188388, 3869679480, -807970088], [-1422683002744, -9600125241, 972794397, -685946389], [150147726456, -357646062, 3348433500, 787447973], [1790293782400, 4233362260, 826017720, 651452760], [-1415828308580, -4844331164, -2671047216, 340475140], [2389524777731, -46596720, -3268407756, -834684706], [2258373037388, 4907430163, -4048783617, 583602451], [647904217542, -6881265124, 998690608, 1309579794], [117456757484, 6651501964, -5620084678, 2063438571], [-1773935725148, 4663167648, 581913950, -1148388512], [1306734695102, -2677564728, 3548838042, 1213550424], [977064097306, 9841741941, -375630379, 2000372527], [-3199053429610, 4148830459, 102286379, -221573827], [4174183322610, 2011118998, 688569090, -236836292], [-135264334080, -5579941945, 6272985939, -1548101651], [-457424055718, -599449928, 2563047202, -907859506], [-1031452628650, 5457895325, 1462806473, -2190000767], [-3195505477341, -12052314011, 1553732546, 211236825], [-760977700360, -7333899929, -3186072603, -2018215867], [1691218976443, 7582630665, 102959909, -1614346961], [-3558116997125, -17563332684, -310748431, -965493900], [5363341452052, -11089431902, -1276062466, -880019658], [3071144766757, -824593826, 4438131235, 3369432519], [-1443485397668, 2419604716, -1940420372, 3657191494], [1816593442978, 20640110435, -10801647797, -1811139637], [2105443274972, 3728150606, 10464213702, 2909441328], [722163635766, 26819144646, 8518325968, -446318526], [1486807344487, 12907990069, -12247990874, -5012554725], [-1831666938523, -6226177687, 2584372892, -4993528105], [-119453791072, -13340303156, 3288203782, 5738846126], [6393686889248, 4871775687, 5012956439, 768643601], [864360609920, -27878336650, -4236833658, 1570314377], [-4259164006280, -21017627768, -15587443756, -2001090574], [-776755955822, -22665886719, -13992354825, -838036869], [2293643934085, 454381454, -11119472634, -3595873350], [-5210107947243, 7615198330, -12173562034, 3290571746], [161755168165, -25438361338, 17850527057, 2952524694], [4454126127791, 27525615671, -7583590421, 5685490015], [3278046161707, -25737275344, 9068326435, 7677217441], [-8702324132705, -12687401374, 8120852290, 5470764016], [-1755680222843, -6237125251, 22691053565, -3172080171], [9672467986024, -15076339573, -17972731127, -550386425], [10623167024199, 2469859631, 20392170860, -2214507939], [-4827536682875, -11010551991, -8852047301, 2724418548], [-70009347653, -2494655596, -26154981619, -4939382570], [-2382668454384, -1018465508, 10342637798, -2135528850], [8438843693010, 7809986232, 25813717588, -4790806190], [-8474683215900, -46529908122, 21246507514, -9069321748], [12469444161938, -699313801, 6225625389, -8710964697], [3973055489434, 54911167034, -20964531926, -4602101597], [1752414225663, 34417684150, 2194411675, 6139835010], [8064110966402, -49718208329, -4376699733, -8841901627], [-6001410779230, 41213458457, 14001765933, -10028070545], [-12425435620314, -20545648666, 22281620552, 4109916166], [260473037417, -80145885435, -6218729693, -4470026788], [1716303424168, -17733459040, 22698882690, 14044017320], [-12311020124825, -18990512420, -17938312775, -4728153180], [-1016737637713, -222084151, 9122763321, -5397924645], [9523214351553, -26779483480, 2407418220, 8342323370], [-7141843209349, 60415471278, -46723758021, -10406472808], [412375409288, -16112385614, -19756725232, -18819246766], [-16059136508418, 39687445132, -51741664812, -10571382965], [3949103754480, 73312792344, -22540076904, -245580060], [-9591250569092, 31512795264, 30422207600, 24983892064], [-18745790517272, -61976678862, -25767156942, -10217279889], [18781633397602, 38350412804, 38237235658, 12298140852], [3638796612296, 5603820572, -36587774428, 8039992339], [13521456560688, -68772120791, 53840984335, 19999729709], [11679839724928, 90305549658, 12181312734, -8916905453], [9705199582040, -3065774393, 33693974037, 6922619949], [-3371567843541, -69985071387, -41105853353, 15190798500], [-34909996189743, 40937895320, -41748119955, 11341947035], [-34764772143808, 54056106304, 5835059272, 3325889036], [-5403928218073, 14217183909, 52620753549, -5213086407], [-25745515512856, 81898156792, 26157839372, 22969170584], [9473355199154, 23604755389, 33380481657, 4093516571], [-4328980288336, 100878120174, 21099029236, 24481579840], [-1256735303902, 50685783295, 24129535475, 6192678285], [-32918310179464, -14816823214, 38752723436, 10709187522], [5905361839536, -14980147375, -33502973407, 19820273503], [15844266746987, -131870933599, -93791136338, 5617732883], [-10971363606009, 19304107247, 70467594299, 14445702101], [21316666890218, 49809950006, 94278223032, -1508749882], [12945297003040, 499530088, -77071904386, 505643002], [-29414390045693, -116674476283, 66394849578, -14484987285], [-611406656490, 181164580971, 70298987555, -10257339529], [-40373257283861, -1022612858, 20373336843, 21662556070], [-8681705614648, 45041751794, 30814824154, 50324950278], [-52341834363982, -49445420640, 41296945094, -20874947851], [15837956987035, -207073398916, -70161006619, -1738401400], [-11259305275878, 103216136626, -36449238106, -22989351305], [-23993730873524, -40319649171, -23754420995, -14581706031], [-20696726596900, -167139166588, 124031709854, -17974824529], [21999121803953, -5949298250, 16992587895, -22189199165], [-28854140814380, 150047822638, 59170340824, 29546684042], [8870229205580, 212809664470, -63384037288, -25289312788], [-35815856163191, 108262980664, -28658204764, 44550441860], [-43949084441476, 174062614174, 30555415030, -4469613756], [-59406881506627, 138470322599, -5368495297, -6226045923], [35630019521341, -119859650173, -22961274810, 43058262847], [-1270491318254, 169199717240, -77014539622, -2010413132], [-16538715577148, 4831015236, 16478629400, -19279590169], [-40913930817879, 63108213232, -56544870671, 15018413021], [22413233740688, -79773792366, -70234980256, -19194506417], [3788697798986, -233607399880, -1805809282, -26771832042], [69133352383000, -99118117287, 132372615389, 16850134087], [-32533936187799, -255031071643, 134564150048, -18631241695], [1383746260953, 94472816817, 142996253981, 50718731403], [-23735095472765, 85033388492, -161421827260, -734319108], [19620545142443, 40766434125, -31204120907, 22338267223], [-28158570634635, 15372101615, -204755115989, 43003957291], [28412144354120, -117565912156, -135706088254, 8698831830], [41569689681812, -161722197305, -29535369521, -10844919541], [45582990451411, 69258903995, 213390818267, 30205975857], [-19042464699168, -159979962972, 77106464596, -679860411], [9451261071582, 77459837322, 129737154090, -15255736793], [2504205716137, -190682755036, 186222157547, -84110280384], [55073618584050, 39482438508, 112665825266, 60173488304], [101730697547950, 70911722644, 181519970744, 21429545943], [11696931559878, 162750871449, 243298071261, 27689822595], [3497436608062, -428292415450, 45533842640, 78822244660], [-38642105740898, 57972956272, 170719587006, 55163290823], [60858928533042, 472575016972, -253724357754, -10328252877], [30807379479813, 211189255289, -58324442428, 45848136041], [66955125430491, -499282090703, -159156831243, 8710347049], [190883814766454, -155917896521, -8376464113, -20939668119], [-72355432804570, -1421120848, -114086416708, -35968759006], [106479617175474, -54643562058, 185128729872, 80774470519], [127544344952418, -208386832282, -253721903980, -17475523542], [17545352219042, -20249074865, 188404133507, -88130388463], [138481884742862, -91982299127, -96910828161, -65044028393], [233683975929239, -192343933737, -26730459363, 47214054530], [77386836498044, 237186818680, -21420527034, -16960229659], [100767061469966, -9849143904, 147669080084, -72931588210], [142348872061950, -129909952369, -87937826077, -66174913711], [103619180266985, -318463537319, -211877752936, -49284798845], [10810716482902, 88389483017, 32439696121, -27738164577], [126568547005712, 352206044819, -250547981537, 3627129647], [-34125018242598, -573387954272, -62320618674, 80992846124], [167137818782576, -243338507060, -28438579006, -94087897191], [27788609095932, -643879051162, 205829883518, -41301834124], [21199511793566, -228210739345, 494489548527, 34303289547], [60008827359703, 223580810436, 125043401377, 72562465238], [-79092510470099, -593090819078, 264802574273, 48947322690], [30331878007208, 428380836838, -40798090504, -54606620301], [106555850834868, 704968105251, -332249604921, 124275200985], [-45310815048144, -266574630311, 211027866149, -153286897757], [-38334888818736, 437976080212, 262429176758, 160430294605], [-98410080367292, 538786087900, 197119936804, 12898258684], [-51579219520705, -163529359433, -423776174748, 88514014959], [231810834784814, -478292728204, 16409971708, 5341859284], [335942026012749, -344838348068, -130396822772, 118086036470], [-95330182050889, 469717285220, -332869987303, 62842721572], [-86553374333086, -97987414284, -44184492628, -191948170947], [-223639753087332, -532788785333, 119065852331, 56025368593], [181417296935954, -111020985192, -259278392658, -156280920790], [111712351894730, 434905429855, -411197037391, 146655501449], [-39726847016472, -246898093414, 18396792120, 185364017271], [29301570355334, 524340936538, -450285374354, 109000256059], [-7701133761266, -769216616592, -80680706152, -89400972974], [-82735934208152, -849281121420, -122625580008, 64066444647], [-60565288754300, -1119026665030, 188140433774, -158367644336], [-72800104147648, 79527678373, -33282572599, -12119770591], [-162827219700303, 49033842186, 404907908369, 3259168490], [-230117945804794, 58524787453, 321133160237, 182690529485], [-161338276643189, 299239101063, -1028390001847, -3932184504], [48378390321489, -557146119888, 171244506357, 11132019649], [-214589701655019, -374827592736, -348724089016, -13027679562], [-214773589216179, -126387867325, -4628100129, -89896943969], [-54509935461746, -731876642659, -242464392411, 53071864785], [98044694130737, -531195449504, -321160133555, 241254731071], [-151237692380947, -292268327833, 500503893025, -206750451148], [-195811337914991, -88793194360, -29424818900, -338383170], [194724398641523, -157433881893, -496403644436, -181138411789], [-33385614319206, -48446575090, -70604424172, -270855706747], [83316668912507, -10113640784, -334852563771, 46818865570], [-304938246555570, 344741931513, 585098804279, 176022924957], [14677303075081, 678103489656, 12572359333, 156039130229], [-209796552641676, -862643740448, -993225981834, -71062680522], [-112539528527176, -530823638681, -387914454147, -270147998013], [-57770420857978, -1441517637278, 304342083648, 20814475750], [-206403856528599, 102213273736, 219967968047, -49572922992], [-17608222944805, 1258880632891, 296614879264, 92520285785], [-2915486255487, 1776116878482, -823488775207, 48586681780], [-114329375213988, 1467778831213, -497548500313, 429040383205], [-109800824830432, 338332924741, -884277725775, -212314643599], [40139819794033, -1053415096210, 1173220296362, -179281848998], [30464747241262, -597272362600, 414348959650, -5632428130], [-262057249517645, -2106180386517, -33909554160, 25146518233], [349834540276346, -1166937348928, -407765940082, -189687099460], [124301041745102, -58754009498, -197716175388, 232885862604], [220199192933884, -1471584302467, 369899851561, 408380407469], [287128217222286, 1435573840728, -38561444910, -153477633592], [-526306280506276, 266440826714, -133885159742, -233391656378], [-11161810882582, -59592667926, -724305848648, 165868927176], [-351108100279236, -777200550524, 145502869602, 314079111788], [186616764493870, -909538704140, -761076671406, -199065028896], [206988404932954, 433876205319, -924765191711, -67083273457], [-326643256203417, -1896504344653, 793947192129, -9496798634], [-22861373121746, 850689246347, -304700955277, 574353643095], [-244489524026746, -334951411423, 954472996245, -26192702463], [283278117518369, 41046236090, 47391456201, 405039228086], [237544170238697, -1885599836653, -38885715734, -310093468507], [-738095482741847, 944847548013, -536568689549, 405597956564], [226177583235068, -945815743715, 1732190787753, -241398510047], [-80026032427382, -1498253966978, -455021880020, 273061592107], [-203498220483055, -109799491547, -799082629651, -466027947943], [-211512142833485, -989679985622, 35697861765, 295610144653], [-256814960316896, 710237776517, 744687453097, 207880776469], [-515726026661476, -3219093832128, 768042708270, -10124444268], [-267915061513152, 123502428953, -619686047619, 400464719739], [-154366769583806, 1797819795518, -484669855248, 191245166630], [326323893017374, 293494051618, 1269508312098, -138551206524], [131587513102504, -37493080150, 854670259360, -489997097555], [381513299704976, -235871517248, -938960750988, 289666609954], [-554700336593324, 1946993854196, 359160498918, -521283472341], [-124916456467502, -1347321392503, -105237962251, -15880296179], [-695839466248542, 2097820333814, -911059329740, -531607051951], [-348257771553933, 170811739712, -476816002216, -14067527314], [-165987589219406, -131311820201, -252716435213, -483152395359], [-364777006618791, 795143852587, 149633186321, -1380994082], [293545491090999, 658892500398, 795723900558, -424535165634], [869468237637911, -549838641434, 612579782219, -435054261280], [-248968563059622, 556013499494, 1962136800172, 541869286361], [162082880373761, 154237945447, 787709833655, -725896791053], [-19446027888274, 2769387534706, -439346188608, -91776814437], [790492282974351, 3985259377771, -587435353097, -105802225291], [663368760951677, -2582097555169, -1553084174431, 206984089250], [-1634663339655244, 349177003386, -718648693068, 131421662193], [175802426723636, 3143353251293, -1505367151295, -87611593027], [-185423426250528, 242819282863, 2206736456825, 64451427603], [-466334610018511, -1828595625914, -1142719140059, -306932350538], [434127290615825, -93008601696, 2787445017835, 416117525764], [-724744080947994, 2827090151999, 1942067875055, -501817746831], [366012297863566, -1379315022169, 533535131037, -196983218457], [1098177518808280, 957652232997, 198571898959, 170753208861], [-1248696053824613, -2828110343020, 211664255031, 117874397291], [-995603912807076, -1820685654252, -1219676810336, -446065700943], [-851652493080041, 704482751512, -3092300192904, -212194388882], [386668201560091, 4550673065556, -52231393031, 567427288940], [903422798898555, 2488387234000, -592071061617, -673366891427], [70419792171185, -783324685730, 857261150034, 496167618264], [-1028563027518397, -108276056366, -3163402130291, -524155995777], [-473844873470370, -3908524648552, -254581920716, -168130445573], [-86421043064781, -169405447526, -2682258814321, -554225051762], [528900858792012, -1917283297108, -2118878487544, 914278735178], [-102248278423318, -1622747106086, 925711806520, 33577437624], [-83623410975815, -4052879883769, 171522903581, 459284342522], [-953353820018458, 1605874419146, 2527750612582, -38176781902], [583728889738416, -3500842831011, 592073599857, 338649836431], [572262387444948, -1644513239138, 249843315308, 206767744655], [644272879574074, -2685954300704, -1868200839982, -123835792236], [1272047844036976, 4617162806751, 337794564259, -121663753755], [-952391896323296, -2592002408632, 722766330450, 756624060928], [-325288046538834, 1481278490000, -2752385396212, 564909683483], [-260801995045928, -5259872242484, -459207999012, 326585912354], [-816723030762961, -5023092651004, -313411314423, 137744050898], [-229600325083920, -5527990637502, 1230041665296, -395773153686], [338506805223713, 2420956316730, 318735850058, 739346768298], [-272419600882626, 2053864350264, -2371086348146, 860414390653], [-282405694722632, 3113949854307, 1527501763295, -451937425503], [-115068977088358, 3774462975668, 1353569489172, 258553304060], [1500435732157166, 2494167720196, -886695233958, 224012309823], [-723368719004899, -411360533719, 796915942283, 890687005714], [24792498601638, -2969404764181, -4290312894505, 230239523619], [464830336785712, 5158815665194, -3673825384676, 87018136623], [1984428423635226, -2192686888758, -368837836448, -334618489566], [-231884129552378, -2501172963202, 2331525685124, -602657618278], [74700408901370, 5244267692348, -3355424742996, 1705458452817], [-773139048257398, -5970921528464, 2015653259602, 225380528688], [-12734027965543, 3424384258783, 368001751281, 1142387513224], [-1155803922609545, 315945522027, 3628839262332, 791682030669], [-1120315238684725, -1885566194574, 1099590339705, 543300947691], [150988433919452, -6199078310013, 1882095240155, 165913347127], [-1202693687256448, -412425200889, 1979872813487, -640489086947], [-1677474201798189, 2859983892127, 148985903503, -280535420265], [2357261621793008, 7114732410476, 444455630180, 516229736406], [-497649242232538, 6920934396663, -295807652881, 1814198428657], [-394388648388861, -2179617743862, -4253446510498, 708013722890], [549658822200868, -4056672780880, -21106234360, -557119928970], [505297528498926, 1255984655598, -1425971325556, -282393035338], [1585442997178798, -1425882690435, 103593862621, -731157234449], [-1981321751237201, -2917245103935, -2496481519342, 582756016403], [88344064129714, -2323158164107, -2280062086999, -107039908381], [-1354536884427345, 3140848526193, -2595566064285, -167061162752], [-102319604574266, -1775284095258, 3884969426854, -2068314187554], [-515717470185569, -6813895288560, 73082461717, -1072358736108], [-919750305838556, -8694369145188, -1196471069002, -1048583689020], [696734630730474, -6980650196051, 2714964164635, 635444665519], [-1372961717479908, 3046366367954, -3534108598720, -1486527017571], [-1440763380931850, -8473201492886, 4549340971340, -114160465336], [174906412335993, 6530934942202, -298723052679, -1599272135952], [-1614817178169430, 1142930706862, -416957618550, -961268254518], [-64715383669918, -1172020964389, 1135454088987, -1663851638237], [3132631905213460, -3515886663634, -486107854554, 312816877452], [1289195867910286, -6326285822126, 1103081403236, 667390053940], [-142565955257822, 7718533349706, -3487772874476, 1027916210535], [-2767048921527332, 4928790530772, -3195642681476, -9253988059], [-261418903154480, 2627674162218, 6471940225204, 1811242683817], [515444104425416, 6566334657118, 5040183537134, 39083404472], [607484078400458, -5654294323452, 6310922946304, -2029053601903], [394973720221966, -602681768711, -1369784358935, 1591117307839], [-478704101171090, -5217424748980, 1498952431186, 1624933756256], [47799929035976, 5947172303838, 654772536602, -1211063717350], [1090705186108646, -2360415374672, 885310579808, -381168702279], [-504610133258787, 1454544524045, -1855309826392, 569072857873], [-763534747290746, 3437681359389, 6437910087253, 2468745526057], [-3016223189670968, 2269179436074, -2699948142288, -377464784809], [-2394124390854467, 2993439762039, -5048924191883, 884483379986], [106836672771216, -5938392979631, -5631394803137, 46755047317], [2047059149312108, -6284352247942, 4752751282022, 1506768733715], [-498472752650030, -3652025053801, 2488006349069, -47137419197], [1248366030871477, -5533987945997, 5120115658603, 1449980167091], [162860173872922, 4567402580767, -6452907184185, -678591212393], [-626884794714859, 1128414435635, -2015429072061, -1626519211961], [-1138417848815476, -7487164421540, 4799362220818, 3052490382418], [1418060785739974, 7460805568418, -4158410806518, 313193673980], [-4340915340794984, 2685129773614, 4467673774574, -1490525709757], [1082906490146869, -5383006321489, 2229557209111, -1578719337053], [-306437402827640, -4782929395154, 4215408589502, -44247557722], [1174753660089162, 4572509705952, -927187814584, -1470411201097], [-2736108026611825, 4183506229902, 534757483821, 345594046853], [-1548208397200071, -11895865165181, 5228207715246, -1414329786485], [-1613001701581785, 7056598877309, 434202555795, -1025459204846], [-871698778081142, 7724389817502, 5578514877782, 1926116564994], [2439490283412937, 4133307628904, -1701635405705, 399999366794], [2102863706602241, -12262009548325, 979948004265, -167204166040], [613564899381373, -1321395073484, -4054773932576, -2318399281620], [1344770612377800, 6134181967343, 1186435033419, 709997522587], [1426870262714427, 9959364730483, 1675089455596, -424206180811]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_342_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_342_10_a_i();".
// 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_342_10_a_i(:prec:=4)
    chi := MakeCharacter_342_a();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 10));
    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_342_10_a_i();".
// 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_342_10_a_i( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_342_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,10,sign)));
    Vf := Kernel([<5,R![1852446724000, -315628300, -3665655, 866, 1]>],Snew);
    return Vf;
end function;