
// Make newform 182.8.a.b in Magma, downloaded from the LMFDB on 23 September 2025.
// To make the character of type GrpDrchElt, type "MakeCharacter_182_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_182_8_a_b();".
// 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_182_8_a_b();".
// 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 := [4029734, 19603, -4737, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0], [0, 1, 0, 0], [-26062, -2980, 16, 1], [-2368, 12, 1, 0]];
    Rf_basisdens := [1, 1, 225, 15];
    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_182_a();"
function MakeCharacter_182_a()
    N := 182;
    order := 1;
    char_gens := [157, 15];
    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_182_a_Hecke( : Kf := Kf)
    return MakeCharacter_182_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], [-7, -1, 0, 0], [78, 4, 1, 0], [-343, 0, 0, 0], [-707, 28, -23, -22], [-2197, 0, 0, 0], [-11802, 12, -3, 37], [5220, 172, -97, 18], [4241, 110, -4, 430], [-72880, 553, 411, -533], [-55593, -218, -311, -1491], [-151839, -314, 863, 996], [-59573, 1965, -1109, -4905], [-315860, 1160, 1882, -4823], [-118425, 4709, -226, 2817], [10616, -14582, 3586, 5577], [-98598, -14033, 757, -9044], [-393527, -6243, -6963, -849], [-1682149, -36771, -5693, 18171], [-2049666, -54511, 4814, -2739], [-1076663, -25532, 5305, 29933], [-652157, -26009, -5933, -44974], [-2691710, -59899, 2744, 61922], [-522220, -11259, 24500, 56506], [2920711, 51206, 14367, -77629], [606825, 60207, -4142, 40924], [984014, -27644, -24, 155894], [-4947404, 72169, -28111, -91744], [3187192, 122823, 2754, -84181], [-1983807, 103315, -63623, -138818], [-15867655, -522224, -68334, 168015], [-6359356, -650872, 39638, -110338], [-5187108, 8925, 6720, -33615], [13336890, 229264, 71875, -60583], [-562095, 47122, 97439, 556118], [38048418, 410873, -63314, 208249], [-5944901, 482641, 248416, -223924], [-18586672, -759386, 140456, -40246], [-19741510, 373500, -121525, -157960], [31629284, 129046, -166449, -309873], [-23303746, -704856, -284314, 145911], [-3641843, 1851047, -69346, 67536], [30109020, -541353, -46109, -735248], [4963136, 1065364, 133922, -1020196], [19167383, -2513409, -197245, -65539], [58050538, -277548, -23605, -175917], [43265746, -465527, 300325, 446817], [91254621, -356502, -857601, 101275], [76325584, -2068182, -504632, -373522], [47546292, 1171575, -307893, -2064222], [-15158277, 214720, 1108836, 1565888], [69005614, -270386, 1148064, 1553888], [106664252, 247160, 639879, 396750], [-21504723, 844925, 1057324, -8236], [-73715254, -2523928, 790011, 312853], [47370256, 3290564, -1009954, -2000829], [45332485, 3658909, -330225, -513793], [-23171929, -3807361, 721043, 3929087], [-135710846, 1962125, -698341, -13077], [-198432098, 556057, -806426, 1041379], [-41029837, -1963303, 1521995, 2031429], [8516348, -4854851, 584222, 4752258], [-127592154, 6392597, -1109968, -2231938], [7621928, 8883108, -1659793, -1265301], [-65116712, -2651916, 1160651, 2514423], [-445521401, 272141, 724421, 1997043], [-284098873, 1631745, 1224189, 6285109], [-392007863, 8256641, -202245, 327518], [-397019584, 12327048, -50692, 4661004], [87542928, -1304725, -59586, 8235542], [-24647105, 4900190, -2113194, -3576035], [-4235490, 14244085, 822824, 5454667], [318838718, 18499286, 2737813, -8393671], [-85185608, 17905605, -1516903, 1191534], [333107186, -8789135, 2175564, 4587653], [-93629085, -5372867, 1154807, 594081], [-689385832, 253409, 2667843, -16135880], [-918423846, -16259715, 2471938, -992442], [-693715324, 3823426, 356266, -8768844], [1230770088, -19747401, 7558478, 10879110], [286877253, -19259153, 309512, 13493322], [620284939, -27359270, -6182995, -596580], [-68639622, -10058282, 1379966, 18294096], [221117946, -46465984, 521040, -6815490], [609549234, -3796008, -3330110, 9851810], [-238060508, 21483355, -2058957, 17036543], [-533001858, 10580420, -2061898, -25584320], [-874666952, 23215589, 13672288, -3598751], [434411424, -24541444, -1504814, -12134616], [651026806, 30503903, -3364442, -13135955], [362601022, 11075856, -4793223, 16372291], [-1810056070, -21924813, -2880220, -8082442], [916437874, 13683594, -4108948, -23394922], [304869908, 41855949, 2046063, -17910890], [16278255, 18290306, -8518935, 14351592], [1666097744, 3733540, 6838688, 610974], [112790100, -30251461, 3745202, 13345188], [385193906, 23162560, -11247992, -13534206], [-3613957705, -7144641, -6053941, -9595711], [1001458492, 62695725, -6658360, -21990643], [-1152602708, 75484869, -10546005, -4485249], [-2789726877, 14285393, -25239239, -7854013], [180538687, -20367887, -5797651, -65264509], [1699373153, -39153070, 14887060, 47570448], [-4716744614, 56892447, -12581771, -11105741], [1277069402, -17483764, -8872416, 5118164], [4977392580, 65442619, 2297272, -1231974], [304296500, 36099974, 8201777, -9289300], [-5330976565, -14747069, 6770435, -26948362], [2889059034, 4180310, 36649998, 5375340], [-978819044, 29188896, -4665341, 25291375], [-4222490827, 21982667, -6296285, 3419945], [2515169758, 33199484, -7604976, -83434000], [-3598082298, 60326048, 10792968, -14761110], [-1295807802, -25401136, 9632976, 49471868], [4300230023, 121307348, -11151620, -8497778], [2059401408, 38424794, -11655856, 37658298], [4312301890, 22814424, -16660777, 50713617], [1695477580, -111120868, -31739872, 8602086], [4832095290, 18070643, -11337281, 26112623], [-5139335838, 57812136, 8960245, -66873262], [-871271289, -82615229, 25615861, -17949316], [-353819803, -34994209, -9681210, 84832], [-7850935701, -38554045, 16496609, 60757757], [-3569899618, 117169936, 29053827, -17476054], [5451784664, 99551125, 10377175, -27499351], [-3308237221, 115832068, -36700081, -69897038], [-3001426508, 194984708, 27376867, 18438795], [-3528471946, 976224, -21752888, -54923020], [-641455510, -104966696, -1110955, 10553326], [-9618982946, 91503279, -14941604, 24163371], [214828444, -224539906, 19360542, 147442080], [-3880050595, -223811753, -34363073, 52452036], [9732008586, -116577865, -9030443, -62814141], [-1073484271, 99316307, -43073574, -21147827], [-509383283, 76794273, -19515722, 68636679], [16150472718, 1082554, -8715692, 7961918], [1430031174, 114684823, -14928414, -9664956], [10941073423, 43976007, -18329765, -31808563], [2368138498, -67584093, 35945185, -89900577], [2304168636, 91766328, 13856584, 16590040], [13945846554, 271000328, 24935118, -86302294], [-14845410059, 34777550, -53248246, -67706163], [10693757672, -3652418, 1255408, -77229718], [7133904396, 87483058, -45100289, 19973693], [3815407619, 16209575, 84275069, -54920639], [-1948794854, -178443312, 30503127, -47527990], [21136522870, 23396962, 46812940, -14544862], [-16797841079, 194673547, -58176269, -1762725], [-4740913208, -299965296, 47686028, -148480716], [-6364561669, 117716580, 16127543, -75182984], [5733984634, 40277370, -109107884, 54428886], [9928778486, -180750877, -13412299, 117305400], [-2703376478, -221039626, -48066492, -155868616], [-2548022122, -75615473, 59738311, 238870397], [-3962282804, 284571934, -45674652, -175325637], [-22593025689, -83918607, -45266919, -98765941], [2524116001, 84461091, -91088204, 16497143], [-10144520546, 28165342, -64120239, -9890009], [6423248320, 866742, 38539493, -76331186], [2087742732, -48929758, 3544696, -33264516], [3304221690, 148615129, 30421015, -65303889], [-2329001588, -143702895, -24403552, 254311103], [-3810378367, 71751233, 132784851, 286462329], [-655872832, 213797203, 36406366, 145092583], [11444983534, -444530820, -180914931, -79219986], [-16833551069, -390952230, -45804992, 178123573], [-27861475391, -273828837, 66697937, 112378755], [10547500890, -69136147, 29786030, -252742937], [3221115868, -288213158, -105280051, 22218749], [4216503322, -513774697, 10281464, -7372453], [-28273985670, -125248618, 26403244, -128938858], [-18606923599, -462992624, -165384928, 30754666], [-7640881678, -471054059, -190686456, -41065385], [-17826724618, -502094990, 13896028, -205238932], [-2842582932, -789682012, 95401448, 311996968], [-25423583923, 161952471, 154995273, -48885209], [23692025258, -629395506, 169187052, 196975958], [-38649586638, -351579706, 18741609, 350209473], [2619187421, 175541017, 100649678, 403687894], [-5886083866, -26907272, 120606670, 179536548], [-4608280681, -129319575, -280248594, -219858196], [-34317866042, -118108983, -59521743, 246009000], [34351173171, -191614486, 3261231, 1215505], [-40593229874, -357246485, -65433506, -159411007], [21495847540, -115880134, 53495571, 318206309], [30870030840, -143100334, 37879548, -142000729], [24490095682, 784156353, 28047736, 139895068], [-35078016264, 565025020, 225483390, 420292504], [20990884371, -160330097, -166416712, 239861815], [-8526528830, 403421308, -165555451, -194936631], [27479307391, 917969231, 36839789, 180925651], [-46337922814, -203178929, 52500759, 30027833], [3946136532, -27747284, -194262443, 129703626], [53382514310, 586579987, 65433089, 16002405], [-33090125252, -289637964, 239310757, -304659997], [25379427278, -415988769, -58983648, -356458477], [-51723445262, 228404503, -174279337, 22264381], [49003088208, -154130810, -150790271, -93195014], [-24409753584, -274565532, 80646454, 593028816], [49736919303, -1052752762, -80662877, -187517562], [-12519944846, 1235191208, 252849837, 200386525], [32241120026, 1083632837, 51599374, -660069186], [-6461450406, 366189156, -121333684, -828127034], [-40242111864, 566657850, 3139945, -641419932], [14734628958, -480884262, -127175412, 726230160], [81791534994, -74863299, 85092560, 189831152], [-14932806890, 1555514970, -23724188, 308013307], [-16456870544, -2052957517, 140067866, -350542031], [-18045766833, -20243713, -3683849, -335338119], [-42986771611, -402090142, -429860246, 59161202], [-60830680305, -391353265, -175185524, -243432614], [-28755808369, -285358083, 48781389, -1025096925], [59304251324, -1391165888, 42428702, -301235214], [-16635383119, -119173038, 91116839, -291217945], [-4765356911, -550510975, 185988244, 321377809], [24616860101, -946648405, 264931739, 189907376], [-6542146368, 118980298, -283361420, -220881194], [14434402322, -1161451782, 64083636, 36076532], [40950853163, 1896405230, -150252153, -475300734], [26549791106, 569344218, 316661734, -236500583], [58690327597, 1066004252, -223421358, 175064291], [25619262624, -826690318, -540732872, 588258230], [19840358562, -231323916, 340793852, -484552200], [13240366901, 772928211, 184280525, 425925673], [38715607944, 141359886, -114278036, -504948173], [-57402534016, 567632736, -17088440, -772557272], [64275969255, 2144760453, 101854743, -191330454], [-11277456886, -2244425692, 266634209, 930397251], [17012671907, 465118066, 247019719, -110702032], [5003869724, 432432763, 124728657, -134624300], [48973673126, 769956358, -201786789, 1522940773], [-32430546372, -2060951802, -164491350, -457302396], [51263897203, 3449069208, -20527066, -764698573], [6678318413, 2952496857, -356720997, 156197297], [71411592139, 2720562531, 384379188, -825894427], [10114800805, -3321866193, 387573945, 880966201], [-50830326473, 1073484853, 289386925, 659625719], [-7070119548, 543225455, -33029753, 408024165], [-82078449300, 2934300000, -310298518, -206085268], [-14871931323, 2425834453, -322808491, -247312827], [15252265233, -1404747663, -383354413, -28437751], [10442835556, 1120831590, 105803362, 623371796], [-66447213322, 385035544, 21484646, -1019046090], [-74974371683, 430114025, 470536876, 796602655], [1205318152, -1335228128, -278203941, -9710303], [-101735803881, 1198506457, -149005518, -2143116759], [-114557791292, -1159546663, -555607620, -239460594], [154791396717, -346955546, -645851649, 591685820], [-42872253021, -3033512856, -175646262, 832746830], [-68534178827, 1380020593, -636941111, 526032829], [-71112795214, 467487950, -434946892, 164150126], [100188539850, -1067592448, 477495830, -88489850], [-128604226142, -822012350, 305550196, -386963870], [-69056385609, 2221688519, 721965995, -54993019], [35858063852, -910023474, 674642904, 62156946], [-8102790310, -2117598987, 357069185, 2824534463], [-59800836826, -1465868874, 86739438, 99199506], [-29574770711, -252255697, 305678585, -986352469], [-6270261597, -1624216099, -62489034, -497541501], [89460921700, 4255370423, -365690831, -215260367], [116120340522, -1251591460, 502246102, 1301443381], [71312190268, 4110352083, 327812534, -2056028478], [-137759064893, 2502970281, -259303362, -208811480], [-17402037761, -185829191, -957767535, 197538517], [49974975192, -1856874562, 30912906, 154713146], [34915006317, 1649947731, -522928811, -3316292591], [-88142353395, -878544680, 311445949, 1062349589], [40685922919, -3734167070, 719316771, 806785936], [56054487924, 2912895811, 545316515, 528372298], [41386047487, 4096305823, -46683202, -1423281746], [134740550459, -485238966, 554059375, -374749654], [-145582389481, 2310327593, 693972237, 244199333], [62663430852, -945621439, -1206921445, 495478979], [-11040967148, -1323111638, -47473763, -3148714947], [74828455176, -1074207838, -1486849610, -436016268], [40895112450, 2197279255, 991232536, -1449632039], [94818210993, -2092887928, 572627701, 1137604420], [38638095644, 2754807286, -39451194, 1035230024], [-30310664732, 982030724, 581856572, -2380258384], [-105638542798, 1902232098, 255489052, -3729512338], [-3368018266, 447735580, 729007048, 763491796], [124926906070, 3874288314, -7771398, -2539102558], [206067941712, -655618791, 527776186, 1380759704], [4225199516, -7703673983, 285756547, 470732158], [72533476765, -2001231813, -155946691, 692382986], [78248033609, -307101508, -1112863112, 385279650], [188284019170, 1525512484, -589625152, 1725685238], [93512648047, 2657452385, -32540697, -911933515], [90294367814, -6663485606, 67423251, -1515878319], [-117634944574, -2832650004, -335628172, 515386295], [245881265799, -481805773, 14088873, 2352930229], [9283447506, 6610454684, -475084460, -2538690652], [88366037116, -725072972, -1198570555, 3588675772], [41896905350, -850720392, 263444884, -1058787363], [185873792570, -3476918754, 761566274, 4755308086], [-50626168736, 2169492278, -353382808, -4733998100], [47171682635, -5948112565, -907477117, -899351729], [253108044503, 204500731, 1176667592, 1260628710], [-22068150396, 147742541, 1551967574, 434010728], [-108197349868, -3985977632, 334032077, 2271073985], [-175958810175, -5714387510, 260703043, -745687500], [69723039208, 3652462257, 1400493457, -2782022853], [-28271428556, -3068124971, -1335546277, 297912189], [480160890540, -1162853399, 549897457, 972142165], [37982759498, -3333641219, -42224116, 593446337], [-268989199654, -9393791003, -1210902079, 3321191130], [201060086760, -3422831888, -451178347, 3355660359], [-26785402034, -2412822298, 867723678, 4281900476], [-263063898516, 3350185500, 1029240078, 3969318355], [303104534632, -234336622, -178682167, 3003748125], [216413864352, -1833819227, 463000042, 2981978089], [-186133499643, -1566335578, 820957120, 3778790713], [-139750047070, 3097960456, 463024548, 262422247], [-139978173712, -413167337, -30868206, -4435020575], [430248496928, -919062274, 74537422, -985933216], [102325408742, 7826995379, -1064919120, -3523590362], [-151206180760, 4371615875, 104264258, 827985675], [-61911883644, 2025658288, 2832461823, -420423900], [-69362995851, -7462084644, 675552542, 2389604150], [-354767561639, -2152013043, 1393252619, -1953135865], [-220118864524, -4689213642, -1718652764, 684105954], [229663663131, 1565227545, -208507224, -5612243934], [-63303846710, 8225505312, 19507490, 3667834100], [-501050371522, 1265930454, 365608030, -896577186], [97314198340, -60467536, 1136894083, 5491097021], [-284215541533, -3953699443, 335977229, -3473159781], [-401943545634, -6860850573, -1647304998, 1076263502], [-88653208696, 4842120271, 3588003725, 498405886], [66386900122, -11032891305, 20332833, 215409154], [-186520467549, -1765105760, 705720991, -2762715386], [-1283675960, -6815887694, -1292634616, -2140751317], [-332891596228, 4625687846, 413681215, -2511230095], [96172651846, -2055759484, 748037471, 6389064790], [39697366095, 591939292, 528985149, -5633644852], [-514118371276, -3543589024, 427543601, 3126731264], [225918686608, -5007080747, -546176138, 455306043], [-95707312891, -5951269679, 728747895, -4648408047], [-165891089706, 3864128777, -1513579655, -6464247916], [-761975241002, -4506754928, -632904086, 3035541278], [-163337519536, 109670489, 705645720, 6582251865], [306199212953, -5454874094, -456766094, 3331028615], [531244701854, -2691590021, -1701919105, -3638599232], [-166543936425, -15100207188, 140215142, 1885537577], [256568050463, -1493753072, 508889835, 529981812], [14987506412, -9716870835, -535692033, 1436977730], [469428433664, -8974723830, -3172762769, -3649605527], [-190993709206, -7384595321, 50363648, 9041210501], [548134802985, -598004509, 178673700, 3542751605], [265044559795, -3032013893, 1523940204, -939330856], [123168333720, 3998896802, 1243281981, -8080033918], [-41851787070, 5403844129, -652736438, 4440094435], [637332568499, -3368605946, 1215522073, 2826245408], [-225541085898, 16304872880, -2421432364, -5068320308], [762048214414, -774160747, -948087655, 1354458564], [383458397422, -1510567424, 2594298681, 1555818919], [60116932545, -10645883906, -607706929, -457688261], [-322209969340, 4702068087, 1318879430, -6969547144], [-207578124873, 1596601728, -3906784800, -805027407], [-375554114250, -4523251503, 284283876, -7483746399], [-263555163294, -5260120580, 1473465754, -182165618], [-151322014614, 15409498402, 1246995812, -640170802], [-372345240827, 5162136035, 3423225091, 5467323348], [326502061445, 7974711076, 315038235, 985823370], [-410883359183, 8938745033, -2577324282, -10686022830], [-429470666257, -10113035766, -1448337134, 6246894544], [477415342066, -4497934132, -2362226677, 5568533110], [31113904728, -1438946043, 598744592, 46534143], [-348952210567, 13803699997, 3484415275, 2751278892], [-11858729826, 3268159151, -3103620941, 1334574854], [120548033867, -13350693561, -632238092, 6160062880], [-510519829860, 7505250705, 801495110, 5976355571], [313590322024, -17462970313, 883135811, -4170835631], [-496789200750, 1796022640, -2470406923, 2939028029], [766921489784, -2170706467, 2109972705, 7042405161], [-389417761640, 4078023456, 654935950, -4842577618], [-176789174209, 19320774796, -1901370512, -563937777], [-874422041729, -9411952498, -896755170, -1315150603], [410669071108, 12522446338, 1294426820, -5444738386], [32021911196, -12763967266, 95901254, -3512685558], [-106070872158, 13220166564, -720207693, 700876806], [-601166191388, -13335941190, -4062827820, 3941832184], [-563798941378, 16645771179, -3062150878, -7580945501], [-365230429998, 8022506705, -2648839576, -922843345], [566080119474, -15560807538, 4894199417, 6744926986], [-949667427426, -876511251, 1909154316, -2313347986], [299829374448, 7883996461, -1662144634, -4195704861], [-175169674089, 23237850557, -1628615239, -9132799273], [-37191296154, 2176023105, 2142999532, -3458361301], [279476790190, 10544735630, 4543466011, -1999074983], [141777004002, 17864004638, 2186242000, -13155322606], [227393010944, 314978076, 2451320049, -8733256636], [-590019525235, 16205530141, 1071621787, -3806561657], [69793931440, 6835723368, 1589258906, 7614988730], [-556137624866, -10737287798, 108812886, 5681751638], [369120515771, 6957069463, 3119200533, -5524347916], [-140570734077, -616405353, -2341605945, 8560805951], [-21063188524, 5414104438, 1179544746, -6433542206], [-236302472642, 1119560918, 4194721388, 6520741709], [-584861376646, 1335463890, -3428667592, -2231817812], [-200553023938, -22317675493, 2819532800, -1582727488], [113315029898, 9684034514, 1391425322, 5260036667], [484282216686, 1926815525, -2294909400, -11973505343], [-311195990621, -10770885581, 2869549162, 5158903781], [435388417182, -11926393175, 3680496944, 1691970074], [342493533974, 17331287844, -1401849921, -1726234265], [-271783435565, -11820056599, -641851373, 4443322517], [-281161590126, 6015214919, -169539548, 12763350061], [-902154686354, 2606239502, -1152657515, 4882975586], [-107546964590, -26313574518, 845701891, -1033448536], [-880477026678, -10595522682, -3297848158, 6826469590], [305119742772, 10480567364, 1330344058, -1235732851], [-481484450946, -2969414347, -3784752735, 2147344923], [578331116224, -8098813383, 3105318885, 2571689952], [-839625718545, -23688458685, -1220892233, 10363498100], [-104528163896, 12490404064, -3860889357, 4023977589], [-288256343954, 5487339644, -3133952098, -6323566552], [-801203161164, 6357938782, 1462101664, -5632361942], [581389112007, -866925421, -4534912529, 1583318021], [-692011475640, -36414333592, 1219331815, 3133310453], [996935041682, 6499943684, 1638417842, -2137960059], [568152222110, -6146233937, -1909562541, -18204719620], [47076712970, -19152794007, -2291138410, -5712475883], [643441141106, -13191295710, -2603501299, -98743685], [-249932823086, 17048409830, 1337019414, -1082039272], [-342574715050, 9195591859, -1248170164, -20450335320], [44752909938, 13310298590, 2607465600, 2451981035], [1105539744312, 4232597286, -2537674008, 5936965050], [-113383058116, -33390590542, 3189131009, 945418704], [549831505786, 29369755498, 6128276482, -3329641520]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_182_a_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_182_8_a_b();".
// 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_182_8_a_b(:prec:=4)
    chi := MakeCharacter_182_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_182_8_a_b();".
// 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_182_8_a_b( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_182_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,8,sign)));
    Vf := Kernel([<3,R![3663144, -84402, -4422, 29, 1]>],Snew);
    return Vf;
end function;