
// Make newform 242.8.a.m in Magma, downloaded from the LMFDB on 01 June 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_242_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_242_8_a_m();".
// 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_242_8_a_m();".
// 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 := [-31788, -10836, -935, -2, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0], [-2082, 739, 24, -1], [-5334, -899, -8, 1], [-12426, -2353, -32, 3]];
    Rf_basisdens := [1, 6, 12, 12];
    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_242_a();"
function MakeCharacter_242_a()
    N := 242;
    order := 1;
    char_gens := [123];
    v := [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_242_a_Hecke(Kf)
    return MakeCharacter_242_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 := [[8, 0, 0, 0], [4, 0, 1, 0], [101, 0, -2, -1], [-164, 1, 3, -2], [0, 0, 0, 0], [1889, -7, 52, 1], [9327, -7, -170, 34], [13856, -14, 377, -28], [8864, 17, 167, 114], [14297, 67, 1356, -119], [-123364, 29, -1733, 166], [-102763, -73, 1960, 259], [-73061, -448, 72, 974], [230100, -378, -4762, 364], [20816, 427, 2343, 1846], [646437, -808, -8474, 4009], [384996, 834, -8118, -156], [1122006, 840, -1612, -56], [1154816, -182, 22787, -1636], [-1256372, 392, -48612, 1484], [-820478, -2577, 3514, 2240], [3974992, 2509, -19299, -4814], [4637272, 960, -43411, 2992], [1596235, 2673, 70310, 9964], [5063559, -5151, 2390, -19202], [-52594, -462, -60560, -520], [4025384, 6140, -150920, -10640], [-781732, 392, -212845, -15720], [1674249, 1060, 77218, 37419], [-10773401, -12362, -152672, -1596], [11138868, 21424, -23546, 3108], [12353264, 12032, 6488, 24456], [-6485118, -6415, 61870, -96800], [15030624, 1994, 92805, -33292], [31163933, -5226, -52142, -7285], [5510884, -30916, 157214, -10476], [-39642426, -12733, -100170, -94120], [5303952, 39816, -264139, -42128], [10156872, -8028, -111354, -108336], [-48498794, 29134, 130300, -71568], [14203756, -29534, -514370, 110964], [-34494299, 102362, -211774, 18669], [-11374132, -9236, -163506, -168308], [54300247, 59513, 39914, -76086], [30006869, 50003, 1171868, 18591], [-35403940, 58452, 1102542, -100044], [-65216388, 55412, -160812, 363464], [30121812, 75340, 672568, 378756], [21812148, -19578, -1084398, -263508], [23713621, -13574, -439614, -203681], [14645483, -93100, -35812, -445356], [-84397704, -90319, -2476367, -462446], [95441882, -145115, -2482678, 395888], [100736292, -239974, 762307, 337276], [-29037209, -244889, -2084390, -190920], [-90304244, -116749, -451371, 292682], [232874169, 82769, -1777340, -375341], [2114548, -156248, 1295652, -642908], [-66985819, -327204, 5086002, 39849], [-335750430, -177421, 4914286, 292576], [94153296, 211794, -5755726, 189964], [34147077, 30988, -6172558, -112489], [101985508, 122516, -1751971, 196152], [-458677548, 270844, -1938430, -10132], [-20269509, -264901, -4886262, 1106906], [-326894890, 53506, 4752408, 1136104], [130829816, -385362, 2424150, -610236], [108787455, 188683, -14287274, -471336], [-162661736, 284494, -10793330, -662652], [113545985, 779438, 7908646, -517577], [368889327, -389460, -15684, 176196], [875427668, -576617, -1592553, 1681594], [114365168, -349761, 8928399, 846102], [144202110, 400500, 3168224, 817600], [-355375976, -720560, 2962836, 835432], [272827288, 92188, 19099642, -1021272], [1109211965, 176473, 4312536, -1703723], [-147275599, 245728, -3783034, 2951213], [268579559, 188990, -4847428, 2629398], [1059270643, 340184, -16705612, -417270], [1069406220, 311184, -17799411, 336648], [-20574003, -24481, 8435352, -179455], [700445056, 1314332, 29324346, 565040], [1197234015, 1038365, 14685762, -1333066], [-753323892, 215715, 6322127, 5533354], [366524912, -855406, 17098826, -4370124], [951122599, 1080463, -1848890, -2922198], [1087842531, 403353, 16906502, -1509218], [6563521, -437507, -8221604, 3267525], [-309726460, 1643072, -3275888, -4254572], [961127672, -718202, 12404118, -873356], [-364960648, -907712, -13378932, 4363408], [194659444, 1271713, 1587669, 148318], [726649996, 1954402, 17645119, 3842844], [-1083603284, 1473370, 24954582, 3203500], [453414360, 1127051, -19175153, -647450], [-1818037722, 789848, -26844044, 3675736], [-123042750, 4448919, 10439274, -4869648], [-48964960, -2376120, -18024888, -1269288], [-742092634, -1721441, 5670182, -7354504], [1172104396, -1382018, -53090670, 11890060], [-619304042, 4294034, 9284232, -5262664], [-1451376784, 304376, -2769637, 6599208], [-36982062, 1638007, -19797466, 5096336], [-4122631628, 537674, 1528253, -10818972], [-3167178041, 1069861, 3763638, -193172], [-737422028, -3009196, -58650903, 2409992], [-106011521, -1221643, -50848686, -891748], [1201616904, 1843341, -48310125, 8651298], [-2629914829, -2651648, 31273988, 5104676], [-376791572, 4024067, 59639687, -1483182], [1472069277, 520612, -3988538, 13464993], [1724173715, -3638769, 67401082, -156232], [7372349584, -936524, -13153821, 9921856], [-2289238744, -4354895, 11164811, -3141598], [-182627169, 52494, 8817744, 1094466], [-3026884648, 1182552, 37305045, -7160376], [446985620, -14208, -95796524, 6641516], [-2601795210, 1770831, -71555754, -3537096], [-4313155900, -442310, 24604671, 7437556], [1704911221, 518487, 77789812, -11522179], [-204578086, -2104809, 22337922, 5842800], [-2258708091, 3545263, 32578916, -25103989], [-183985448, 6771464, -21015681, 13816616], [-4271542816, 3616586, -133937762, 2774692], [-5881134423, 3420735, -86395440, 6580701], [-2959393330, 4712348, 105618520, -4612160], [-4453679020, 1851979, -63858753, -34476998], [-3884363884, 504611, -6448613, -17770094], [3981017137, 2867827, -115571820, -18987617], [3680186084, -147858, -25370769, 16537740], [-2386126512, 9745951, -26235853, 26722598], [3841766284, -9472004, 55891452, -5094380], [5572821333, -11782321, -58881816, -1808251], [449086787, -1279280, -132836988, -39127274], [13153564935, 5194623, 34390730, -13637210], [-4474384210, -619892, 117513048, -21310976], [426888820, -7616608, 131420384, 17817432], [-29981242, -4967078, -206039844, -10219712], [10318406050, -670677, 85507838, -21967616], [2266884984, -12786430, 9504702, 31533548], [-5126422706, -11853594, 86228756, 9119056], [11257116252, -3390196, -15454842, 21961604], [1963713040, 17132758, 3277825, -17137884], [11448519209, 19332517, -79328200, -25447651], [-18160231380, -1083333, 123448563, -11438958], [2266592077, 5957892, -211501094, 36984575], [16365342986, -2433048, -32296616, 38072816], [-22043178324, -12374958, -4214866, 11886412], [-7487725556, 6756481, 49356829, -27321546], [2159036369, 17368034, -52108070, -16283747], [109190095, 23453865, 61551998, 383800], [-1013094596, -2976736, 219658292, -8430696], [3853846548, 15667617, 89379069, -29233434], [-21121168684, -19918916, 139475384, 41812952], [-3524390840, -17020924, -19894632, -46645984], [15232830536, 2243208, 265616382, -14862888], [11102619399, -1146141, 185948082, 49071690], [4565587011, 12564963, 305989466, 27977740], [13870887057, -1943808, 222842082, 49777389], [2857977560, -7635710, -152004171, 47588500], [-12902850213, 2386089, 377872470, -50482350], [29711903704, 4245473, 83148545, -25874214], [-7425608888, 7762460, -305964681, -23983576], [-29817998761, 6223122, 252030484, -38604190], [-26897810708, -4047220, -277362108, 26194868], [-6454621652, 5051512, 379338108, -63748220], [-6092335643, -24808249, -304244164, -12158709], [5782578775, 6338666, -197927632, 24564750], [10255242894, -3384178, -163006496, -48290456], [-12359350340, -12606896, -121447739, -3863280], [8980332886, 5576188, -133474944, 44547280], [-28694069388, 17135871, 37487325, 31889730], [26626669419, 24172976, -538336428, -55182160], [-1977963636, 6252079, 421415431, -97682982], [13058499467, -19231297, -79108642, 112817760], [-13477912844, 903154, -179847714, -65593676], [-8819182203, 26278671, -532376820, 90497091], [12567463668, -301088, 32411284, 135419172], [-3907545375, 25689665, -76474812, -67420255], [15567160128, 16228971, 584651015, 32133982], [-23767051020, 38427384, 26978919, 43516824], [-677268050, 9581412, -590430500, 27512792], [40324900883, -16591415, -150564774, 20755528], [-6986150384, 5313716, 61278444, 98730872], [404987950, -15081797, -610533554, -19138536], [-53937572519, -21471266, -127913250, -3917915], [-34847799456, 33566248, 51299284, 34702320], [21366964779, 25115962, -618666140, -152165418], [-22520632768, 42344651, 218866487, -63828954], [26621952370, -32840852, -53955744, -63074960], [2763183928, 61181246, 351878403, 3871268], [-42455012908, 34535804, -444068744, 33339616], [18111960297, -19787838, 811738890, 33278673], [-7110882996, -20174866, -229568915, -171034820], [-2206521237, -23674018, 1068019324, 46431184], [-43819547449, 36629882, 539007520, -190142468], [72431122742, -12113394, 260467920, -691944], [-4089104913, -67922934, -160656684, 75352536], [10041830840, 3462484, -73449144, 51851992], [22410842742, 15795622, 202385036, 49681712], [20971943900, -35207168, 275984138, 101287508], [1800208925, -18908993, -829137604, -68151433], [21635401367, -22930663, 1005938638, 4094032], [-14585146052, 53343602, -56248698, -222856108], [17555066102, 65541582, -227234480, -22165432], [14173569692, -16597200, -419461842, 259533324], [-45614570888, 74616522, 558036179, -104060780], [25366224315, -33994956, 155293908, 157069836], [36502456220, 15244824, 803912181, 177778032], [62682403623, 23927728, 809321800, 106555902], [-50373317619, 5276868, -1032271242, -60772173], [-42583501856, -54826684, 610032218, 14263632], [-67691001032, -34677916, -730098855, -21845320], [-34603037616, -75097365, -618847359, 116274222], [11685130043, 649314, -268707012, -267820590], [35450073244, 21107255, -362871151, -179526702], [-31046162614, 59635679, 111091202, -23039712], [-84060675540, -25952891, 373483871, 203366294], [-69102122935, 67958471, 458654468, -34297479], [-15166489403, 15794639, -1870215112, 86144223], [-25271421544, 57532303, 224174279, 227538470], [19666576047, 148358026, -318657376, -131572642], [51780495152, -63919871, -567894571, 72281810], [-13902765988, 12912048, -620388152, -379477192], [44293007357, -72074254, 696482278, -207211865], [14156290395, 67761823, -574410730, -246971788], [30588798684, 56747037, 167276709, 3693630], [31082791112, 55303717, 745225607, -215220478], [99660538152, -31393398, 529438581, -121192212], [61358580977, -58675626, 768163950, -213167835], [-25252968972, 72010530, 156990806, 192397684], [16697503840, 32984320, 612030306, -77388920], [45358058891, -40377598, 649612544, 150724152], [57897630764, -23982450, -402691014, -66698196], [-22140401828, 91004495, -583281351, -166805158], [67752249770, 40708473, 1114720278, 267505056], [81022853461, -105315715, -536875896, -46093939], [1934151540, -129393732, -126215784, 109282488], [-63937351048, 23054648, 1519085402, -93313800], [74531419236, -69826188, 846176145, -239358456], [76655018600, -54895320, -806194176, -162761664], [27451479172, 33240344, -241561654, 36380004], [89495111353, 70595155, -1580771496, -295176065], [-54191634478, 52737564, -629747096, -145413472], [36329615480, 50051757, 1374764617, -70061086], [-113893574320, 145865141, 572627437, 24773074], [-46029257404, 895652, -1427841220, 37659480], [51246573476, -105293604, 557599071, -426978024], [-22089002996, 27519760, 872514232, -147197484], [-9974570426, -52191289, 1111296086, 484218840], [-99997929857, -12816058, -356944776, -238526548], [-32952461768, -33529308, -1666612456, 288111064], [-38417848101, 19576558, 1659448840, 79800852], [-79446284159, 73055845, 544184992, 253298661], [-88572837708, -81434610, -1141897194, -339902604], [-46045775987, -55659866, 834246906, -224741189], [1041538900, 171404234, -690141850, 196076916], [-131906089515, -136505688, -121484142, 131531691], [35507699234, -98781259, 377684674, 17368240], [-244866964200, 20020197, -285287869, 30411970], [-211649241452, 33803060, 1692127887, -184477744], [101854635013, -124718958, 23487382, 97260971], [-13200752586, -93255473, 2052223822, -127214808], [-180445066833, 95056050, -800153328, -74020962], [177677994252, 50193146, 519790941, 413191604], [-130259813914, 61943162, 584913296, -345811368], [137539292946, -246602421, -1221226182, 348776208], [124035249116, 83374568, -987616715, -173295728], [-8769851170, 6077958, -757038848, -261928648], [82965093273, 171236999, -75164748, -368234065], [-37824252816, -59973008, -2301494252, -434173512], [-61766443069, -248023622, -1119879700, -63299440], [-43188030824, -71813695, 4734126047, -5724390], [63747607562, -77194307, 289314398, 514576880], [83933002944, -47156584, 1820927088, 393670472], [28920492260, 86214728, -2405539792, -96851136], [-32152348063, 24269034, 802535658, -597277677], [79612554154, -87245296, 1051080848, 74733792], [47990123072, 39085914, 1045160287, 400172276], [-211851519824, 209726912, -1399168038, 432039848], [-98447083288, 71541748, 421602386, 15992216], [187908340980, 43362753, 2922137553, 32456766], [189053790269, -58806297, 2636412420, -419409759], [110345184124, 40188174, -3892431359, -638451004], [79345404240, -12892281, -1721404995, -395908074], [-118903258006, 90853831, 945729338, 718465760], [86591386094, 151972267, 1392488622, 21845848], [65126019376, 58182075, -1600386431, 713492894], [-205364298601, -146267455, 1393640438, 376057740], [42907176865, -25410473, -3982307396, 429097701], [114334006480, -3285796, -1787535231, 293434400], [122923342907, 148589287, 3054445962, -508835276], [-75107467424, -10715836, -2404534020, 740148248], [-89475576298, 72152512, 4247278916, -89395672], [83718690022, -79791380, 962763892, 1256145912], [155321682552, 173533089, -240510325, -344611574], [-110350041059, -116816774, 3996652066, 662857635], [97358543320, 204911708, -1955090796, -152830888], [-4749652360, -213985266, 3315372453, -190719276], [120284476842, 147446600, 3765728328, -292036528], [-437200306903, 48059126, -1421400550, 104525799], [-36452833816, 184066819, 684341039, 215566694], [292141157064, 69181338, -1027035426, 499041420], [-118946372032, -21543998, 2537259731, 957177044], [-31191486142, 100106216, -5852027720, -428806640], [-330496467024, -145106568, -2747519508, -314504304], [5276782937, -388296600, -2266164738, 9386247], [542808046608, 99536355, -23751759, 113538918], [154024896669, 489955496, 5150464074, -158806507], [135293468464, -149379025, 4182641925, 470320622], [-59984517107, -211956061, -602033604, 347572091], [99153186743, 242275051, -304428198, -574788038], [112954736784, -211168304, 2099774839, 603701688], [51615247988, 2878520, 814056842, 980542428], [-381970620645, -73704558, -3525925828, -154806908], [385598906708, -168579804, -925900601, -406187272], [207893647324, 18018748, 1545843424, 1024883796], [249358224954, 151662391, 3617575342, -649091712], [-131060605233, 6427737, -624398802, -1004423772], [357589308796, -21884580, -1427963204, -245473408], [-213336793061, 177672329, 5970545150, -1187481630], [326137637169, 107569099, -370640104, 464024063], [74861859548, -738309740, -1198334800, 682715708], [259303062395, -251061016, -2259971344, 370260450], [131024821322, 54956991, -1042117830, -1007497680], [9110258968, -195660636, 851881048, 1526290616], [56721827704, -331693622, -7761319254, 630355924], [-257542382624, -133316368, 387032364, 781463432], [413576318813, -23325268, 2253754478, -818709303], [-137199830903, -590340402, -5455731470, -344862961], [-162119141034, -394933176, -1486880928, 362615184], [164568427552, -296220908, -3720386328, -650276816], [591165073132, 380628574, 1283837323, -425764476], [-411202250836, 525352880, -481774895, 1126643704], [-206741662704, 408889446, -5750841999, 344102148], [-241264714535, -377198538, 6815618698, 779843921], [163156434106, -83187341, -3101864282, -530411376], [-335070228517, -188623420, 3495980944, -1041883400], [-564452489204, -158286844, 2331637052, 1012945092], [110597259517, 60545003, -6208128376, 304634139], [-206022365942, 132521780, -1490428728, 1360162496], [52888263573, -399506012, -1688365138, 1743128603], [52529625676, -206751868, -8695983856, 1065252204], [99807700278, 122401119, -9638650578, 118683240], [-299824115880, -309637844, -5897142364, -882762112], [21088285053, -98545455, -1359599824, -1199942951], [237060066172, 288368182, -4621246839, -463535468], [413467521992, 176864280, 424440520, 233760200], [795605209765, -133671420, 1033865750, -515565899], [-226790862116, -226460666, -7947999033, 1079595436], [-6166981950, 429276905, -2755442754, 321140816], [-116031332631, 193054737, -5227295016, -1232060385], [-167418930536, -482363376, -2873420048, -198737800], [-33046290475, -54251320, 6642709330, -71866523], [-127560377685, -106232603, 5413949942, -866846032], [-390662812748, -204763505, -3282304223, 137924922], [-495300337876, -101750412, 799671640, -335830096], [378581045775, -300261627, 2968550778, -775961346], [418598106108, 526738444, -8414269414, -231009652], [67338735822, -93217372, 10328153748, -11378488], [-57325575422, 76464123, -4755060214, -50867696], [247065449960, -187156132, -2361895642, -1498596384], [-572287238876, 47217166, -2100958403, -1835296380], [6309836472, 761392340, 2374663653, 484409672], [-810026202669, -412524997, 7977695070, 1182217256], [397361789841, 432920318, -5646395306, -1631370911], [127452079308, 400866544, 2706455098, 1929637140], [-809041323645, 144650450, 4724541972, 1426286594], [-286004827992, 630127074, 3415667181, 1148265132], [-4127319616, 710237864, 11051583100, -958675760], [1951289916, -819767967, 4450015545, 146577678], [-376625847019, -242926562, -1670693394, 773591833], [-414633849372, 256957120, -10302915782, 1166046084], [360228795329, -172006443, -9986755632, -82994313], [-147365201084, -131633414, 1967022847, -429419460], [-110293762608, -331763189, -4136347231, 302941454], [426751190191, -412909844, -1330400736, 2301738952], [52465086431, 736279511, 3675249662, -463483734], [146759404546, -246198971, 6395996466, -2110529072], [-50132934074, -1023276158, 2117480920, 671837544], [-536646637157, 129333380, -2432670240, -1798414030], [-66036881312, -77226392, 2922460278, 1833232024], [167412597506, 8435172, -4318277720, 1794298208], [-653643823740, 104150828, -1787702229, -918709720], [-240143523120, 285467031, -3240665613, -738049914], [-280407909736, -442035287, -11672496481, -1564359166], [878239889765, 297367204, 13670483462, 1161426761], [438743183256, -265620698, 17507832646, -1057790076], [-261995346920, -600055984, 6422334402, -1110873712], [-209006407526, -129664597, 4025029682, 2082848784], [-923465609010, 549491904, 6011271564, -624028776], [-374083300132, 1024992224, -9590328733, 687394752], [-231976213476, -171743594, -13439228729, 619171764], [-1087816906976, -33044756, -7062018278, 561363072], [435843938578, 478488019, -11291116782, -1465624496], [178622928732, 363436804, -5083942706, -2404137396], [-591505960445, -74643687, -2522461570, -2454548570], [-724537068732, 10177564, 12103351867, -108836496], [677153947605, 7768458, 9954793230, 1124136633], [303284520873, 292951218, 1532777858, -649018847], [-38711693937, 1161617694, 2488847220, 987702234], [764434683616, 905696720, 11732448140, 524507664], [-962146886806, -617891704, 3021293144, 615205200], [-502284939106, 16177139, 8555520542, -188652648], [238039067980, -1009823183, -1207840473, -836884610], [-779945328951, 163797794, -879174462, -705156145], [354421594535, 233503708, 3733677648, -1437614294], [-287057117724, -663919068, -12085158967, 1895671456], [-188154881232, -799696424, -11376994168, -719395072], [881466956999, -338736444, -14809419336, 3121801224], [610713185749, 657770121, -6761118472, 703969057], [113869490500, -1869494044, -1017831, 1869603560], [29940081160, -811731612, -1108400531, 2298251672], [-605560326781, -469599047, 1656243590, 1503727496], [972671861385, -288768346, 12163724050, -491701505], [564843588280, 116474149, -10843730693, -3712614726], [45765854052, 911445825, -95209177, -2068449146], [-1099767911062, 46284459, 2382813058, 1886836688], [761887451776, -240821815, -5833703961, 200624954], [-45919872695, -15393607, 14319529452, -3726538315], [-357442819234, -915887974, -4373626244, -757242992], [-264458870468, -100943975, -8465939825, -3524552370], [1726679795424, 445349076, 10667268864, -406072488], [255874851507, -649491697, -5242209150, 2377850294], [455729584001, -943610645, 10392078528, 357431497], [-485844489796, -421407614, -4869582078, 3835746100], [507401915026, -1482729869, 6513972574, -1942941024], [925265927776, 338481326, 11544925058, 3939061956], [-2256506738212, -136352444, 2492050458, 254923876]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_242_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_242_8_a_m();".
// 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_242_8_a_m(:prec:=4)
    chi := MakeCharacter_242_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_242_8_a_m();".
// 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_242_8_a_m( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_242_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,8,sign)));
    Vf := Kernel([<3,R![6673968, 182016, -8304, -16, 1]>,<7,R![749784850352, -1247214848, -2340240, 656, 1]>],Snew);
    return Vf;
end function;