
// Make newform 147.6.a.o in Magma, downloaded from the LMFDB on 19 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_147_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_147_6_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_147_6_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 := [-2338, -1856, 941, 122, -59, -2, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0], [11802, -7063, 742, -546, -35, 28], [-27289, -42269, 2547, 3961, -53, -87], [-143678, 33579, 21656, -6316, -521, 158], [71402, 81453, -17195, -5988, 512, 108], [-433643, -447553, 55188, 39032, -1297, -774]];
    Rf_basisdens := [1, 1941, 1941, 1941, 647, 1941];
    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_147_a();"
function MakeCharacter_147_a()
    N := 147;
    order := 1;
    char_gens := [50, 52];
    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_147_a_Hecke(Kf)
    return MakeCharacter_147_a();
end function;


function ExtendMultiplicatively(weight, aps, character)
    prec := NextPrime(NthPrime(#aps)) - 1; // we will able to figure out a_0 ... a_prec
    primes := PrimesUpTo(prec);
    prime_powers := primes;
    assert #primes eq #aps;
    log_prec := Floor(Log(prec)/Log(2)); // prec < 2^(log_prec+1)
    F := Universe(aps);
    FXY<X, Y> := PolynomialRing(F, 2);
    // 1/(1 - a_p T + p^(weight - 1) * char(p) T^2) = 1 + a_p T + a_{p^2} T^2 + ...
    R<T> := PowerSeriesRing(FXY : Precision := log_prec + 1);
    recursion := Coefficients(1/(1 - X*T + Y*T^2));
    coeffs := [F!0: i in [1..(prec+1)]];
    coeffs[1] := 1; //a_1
    for i := 1 to #primes do
        p := primes[i];
        coeffs[p] := aps[i];
        b := p^(weight - 1) * F!character(p);
        r := 2;
        p_power := p * p;
        //deals with powers of p
        while p_power le prec do
            Append(~prime_powers, p_power);
            coeffs[p_power] := Evaluate(recursion[r + 1], [aps[i], b]);
            p_power *:= p;
            r +:= 1;
        end while;    
    end for;
    Sort(~prime_powers);
    for pp in prime_powers do
        for k := 1 to Floor(prec/pp) do
            if GCD(k, pp) eq 1 then
                coeffs[pp*k] := coeffs[pp]*coeffs[k];
            end if;
        end for;
    end for;
    return coeffs;
end function;


function qexpCoeffs()
    // To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
    weight := 6;
    raw_aps := [[0, 0, -1, 0, 0, 0], [9, 0, 0, 0, 0, 0], [16, 2, -2, -1, 0, 0], [0, 0, 0, 0, 0, 0], [107, 6, 12, -3, -8, -7], [215, 12, -34, 2, 8, -3], [521, -31, 32, -7, -8, -17], [231, -55, -174, 12, -24, -3], [-759, 0, 16, 45, -24, 51], [-837, -201, 86, -54, -24, -63], [673, 215, 94, 88, -56, 63], [3758, -300, -24, -54, 96, 42], [4961, 23, 656, 65, 136, 151], [-1218, -208, -120, -90, -32, 150], [8645, -381, 206, -72, -184, 47], [13832, 1614, 996, 132, 208, -58], [2115, 941, 1794, -100, -280, -115], [8803, -74, 1186, 328, -200, 225], [1794, 148, 2496, 414, -304, 354], [-19359, -2364, -3200, -243, -120, -549], [12854, 787, 6584, 266, 32, 138], [19592, 3992, 3240, 468, -272, 312], [17178, -622, 828, 764, -16, -142], [-7483, -6481, -4588, -169, 1000, 355], [9896, -6723, -6220, -22, 32, -432], [23838, 7438, 9210, -917, 1984, -326], [-11435, 3319, 5734, 880, 1480, -885], [-21571, 5862, 10148, 2139, 1768, -25], [-25860, -11450, -9636, 342, -16, 1008], [-122818, -2628, -40, -228, 1312, -448], [115606, -4832, 1224, -198, -2128, -2310], [-15866, -1882, -1772, -2188, -720, 2598], [-40921, 3501, 7154, -1020, -248, 3101], [88800, 6208, 15864, 2088, 1440, 3828], [-185288, 16590, 22132, -4524, -1744, -2786], [28506, -4272, -21216, 2106, -3264, -2562], [222239, -592, 14882, -2140, 2168, -843], [-76782, 2720, -37728, 990, -2480, -1518], [279749, 2763, -5242, -4500, 1928, -937], [191520, -20128, -25782, 4925, -2752, 3992], [-145023, 12474, 34156, -1557, 840, -4341], [269941, 2040, -43478, -746, -3128, 1479], [-7179, 9132, -19104, 3465, 3240, 6591], [35214, -4892, -57384, -1368, 7712, -3108], [-162140, -29886, 2076, -528, 3824, -3098], [164312, -10484, -47536, 2480, -352, 2424], [385460, -43176, -26424, 1620, 7680, 2880], [47704, -13556, -13184, 928, -12416, -14640], [-135817, 18529, -56014, -5480, 1032, 3657], [113537, -43996, -36454, -7102, -4360, -4005], [-45103, 2475, -36578, 1284, 3640, -2173], [464081, -13440, 64144, 10653, 232, 6467], [258432, 68547, 22164, 11658, 6288, 12216], [35501, -78349, -26314, 2096, 7576, 8659], [112463, -3259, 26204, -8011, 17272, -7223], [-485741, -54000, -42344, 3099, -3400, 3913], [-23210, -4064, -39794, -8459, 3200, -16822], [-955363, -5073, -6634, -3592, -18040, 1563], [-328570, -34060, 28056, 2952, -8576, 19452], [205049, 120051, 60942, -1884, -4520, 6347], [54027, -16743, 31050, 13644, 28584, 13257], [492922, -45894, 44890, 6783, 8752, 20974], [-603355, -33701, 42614, -10828, -7432, -24489], [-929253, -6083, 81570, -392, -8552, -10295], [175082, -31859, -42652, -18484, 21152, 8286], [-156136, -57486, 127164, 39300, -12848, 10898], [346100, -1812, -236184, 24660, -7200, 23520], [-17622, 40054, -128580, -43992, -6160, -39114], [-408285, 120006, 6844, 10773, -6600, 15177], [874323, 99952, -10134, -22188, 24744, -30735], [-229583, -113543, -136556, 4723, -38392, 7559], [1109603, -81252, -83368, -4773, 15832, 11033], [-24710, 49770, 312940, -2048, 11440, -2058], [-490114, -128276, 108120, 5184, 36128, 4236], [-313480, -57628, -182040, 8280, 16480, 23724], [859664, 192648, -85576, -33060, 416, -28528], [-1095397, 94899, 205198, 17502, 36328, -7927], [-46891, 91068, 57350, -25852, -59608, -7017], [-18295, -241893, 47614, -11172, -31784, 3227], [1461752, -232527, 52508, 17414, -3664, -41040], [-3039283, -289509, -29554, 1212, -14056, 6611], [-732750, -1792, -161808, 53352, -16160, -4296], [-682607, 306024, 134736, -2355, -9304, -4157], [-669710, 245935, 252364, 25624, -79712, 24582], [-2317068, -197068, 4680, 23136, -192, 16116], [-2078571, -69870, 38844, -19665, 45000, -14577], [-323278, 313728, -190768, 61836, 32416, 14108], [3881766, -79224, 346128, -31824, -3648, -8568], [1418756, -178392, 179234, -14763, 68336, 21764], [1639346, -107624, 120000, 11898, 53552, 30438], [-1533587, -21205, -97898, 63368, -3528, 84315], [-1797703, 70423, -483370, 12976, 68136, -1749], [1963882, -7096, 110160, 26154, 34048, 9030], [-3547681, -49374, 590268, -12711, -32264, 20933], [1444378, -257924, 79224, 25722, -10912, -13782], [699078, -17886, -289428, -47988, 47568, -87990], [-4226874, -332368, -550074, -32455, 37808, -21142], [1490187, 106031, -539400, 10391, 22376, -74899], [-1398562, 108606, 463532, 19616, -14416, -65514], [1868010, 11068, 168840, 15552, 121664, 29484], [1646836, -354396, 267216, -35352, 43440, -43320], [-2619092, -414714, -460716, 10740, 5264, 12766], [-4738833, 347657, -192246, 98828, -69400, -33199], [-755941, -193251, -621198, -118056, 26632, 16985], [-2998184, 278596, 174912, -82116, -34864, 60684], [146988, -295631, -10944, -82980, -101280, -30300], [-1679433, 216385, 690354, -96752, -132824, 6625], [794519, 324211, -146980, 103477, 8328, 196737], [-4872055, 288900, 68400, -31251, -37496, -87469], [5335280, -237617, -731608, -90556, 44672, 37584], [2990124, 101072, 667944, 76152, 112224, 145596], [1581046, -138052, 1220952, -88074, 18112, -28722], [-2823485, 723693, 631506, -113928, 84296, 36265], [-4268034, 13998, -870804, 64992, -81456, -161898], [3611970, -809432, -239664, 50130, 44336, 134934], [-2029979, -467985, -1335514, 44220, -16360, 54847], [1916779, -139655, -130022, 42028, -15128, -80559], [-7001711, 9351, 674350, 30180, -88568, 70723], [4363799, -332301, 161358, -47262, 44968, -152155], [-3436425, -307014, 471508, 71901, 162744, 136701], [9603269, -538862, -897298, -35872, 1784, 73623], [3784620, 54076, -252120, 18468, -87136, 64920], [4029824, -199884, -307462, -50283, -216064, -167272], [-6852603, -8670, -601412, 100863, 175368, 4959], [7590198, -284558, -421188, -99000, -49008, 22230], [-5366151, -434223, -990662, 106434, -131976, -103941], [-508304, -1031842, 2604, 121266, -7184, 188508], [-1202350, 654326, 905492, 205220, -33200, 97798], [-550999, 856787, 617294, 32960, -92824, 212367], [8522587, 68950, -503642, 14194, -125864, 6057], [-638402, 540440, 1051824, -22230, 141904, -170082], [557881, -1596492, 423192, -114999, -98488, -17189], [1045508, 704864, 202824, 213120, 214336, 47220], [-8264620, -190802, -527028, -112122, 258992, -104712], [10709767, 609725, 252496, -74401, 66984, -249087], [4759542, -474813, -758412, 213216, 200064, -21582], [8189246, -381258, 395870, 171165, -20032, -209254], [-6320322, 470738, 1571004, -253920, -52368, -94482], [11444276, -130352, 121286, -105617, -34560, 2676], [4589750, -906960, 495312, -3612, 95296, 24020], [9610326, 551758, 1308204, 46848, 39024, -47802], [1140188, 518694, 1029028, 120300, -333008, -125746], [7426564, -417168, -1239384, 17928, -200496, 111684], [2277941, -838518, -781348, -32601, -404600, -152233], [-1821279, -1888902, -730974, -52026, 78552, 21483], [-11069855, -133665, -190082, 11172, 476392, 142891], [7620675, 761108, 1929354, 39348, -112152, 328641], [-235625, 242765, -604832, -52633, -151704, 158529], [-10974179, -51725, 161302, 27964, 220216, 33183], [13066177, 1995408, -1046072, -150351, 79112, -172469], [-14153886, -156868, 1068312, 82890, 132544, 29130], [11217011, 521339, 2720540, -121279, -86168, 80149], [-7643326, -2125340, -1352856, 188658, -354592, -145782], [-1126909, -1467, 1553114, 5292, 66968, -266287], [3660974, 333900, 93672, -47898, -221184, 74934], [12098685, -204912, 1146192, -206055, 59400, -22761], [2196854, -560800, 460536, -240822, 166432, 22650], [-9718677, -16455, 1819800, -262737, 255672, -238563], [2185456, -357961, -2063024, 180784, 321232, -61152], [1118732, 1144994, 10730, -141367, -208784, 186628], [-2526955, -1084302, -1123084, 420747, -100856, -77281], [-2768378, -402156, -1999944, 88464, 8960, 22540], [5286094, -425248, 1760472, -99630, 111472, 27306], [135012, 1108280, -388560, 74792, -241696, -411664], [5929087, -1413471, 817402, 72480, 201992, -205787], [2306856, -303080, 323280, -293432, -478496, -236192], [-19518026, -417648, -2624952, 26082, -149760, -339846], [17049469, 1662282, 381934, 254872, 361912, -227841], [-4206694, 2739492, 5451288, -92880, 25440, -255660], [16436188, 443168, 279910, -280417, -196272, 282924], [-11541599, 2666418, -672324, 87699, -216664, -205397], [482401, -52240, -1158482, -169580, 31432, -313029], [-14578143, 1134228, 4470176, -43299, -218520, 101355], [8485410, 431122, 2095620, -128952, -879856, -171294], [5222348, 570244, 1870616, -367000, 37088, 197556], [-33649331, 1599297, 1625140, -315273, 42328, -31973], [-292248, -798328, -1931184, 202932, 114544, 570060], [251117, 1672689, 762202, 29886, -396392, -310993], [10965489, 1570815, -2587602, -579408, -99576, -406737], [-4822031, -747214, -734522, 75928, 407992, 150459], [27579676, -743576, -2016048, -472932, -217744, -14892], [-768352, 2805884, 472232, 480032, -284384, 454420], [-4439020, 776626, -1533420, -398250, -167632, 393732], [-7051559, -3776703, 368164, -418725, -564872, -24977], [16437173, -159240, 997984, 445785, 638632, 427295], [9762908, 972608, -2551750, -319447, -748496, -542564], [-24629094, 2492800, -2142864, -390456, 392768, 395328], [-8892880, 3589312, -316840, 660968, 101888, 366036], [-26028734, -4381554, -5039460, -215100, -101712, 85650], [-9871890, -4377054, -1865940, 177228, -393264, -462774], [-5163350, 374125, -4849784, 392062, 233776, -192714], [6987559, 2271750, 890852, -550059, 858296, 145405], [1192460, 93728, -384072, -115524, 769216, -413520], [2451604, -2513956, 2381350, 249719, -61296, 186996], [-16455627, -127314, 1952724, -435213, -770136, -327657], [-22447625, 1887927, 1041148, -374283, 485032, -111359], [-1121460, -2547704, -4283520, -409176, 488960, -516048], [10815668, 2236826, 864132, -46962, -1259792, -481404], [12420517, 3210135, -325196, -406017, 888280, -89069], [-16530699, -1068797, 24222, -383552, 500968, -177281], [28668836, 1828830, -84268, -494904, 636592, 124490], [-8962050, -3242478, -4926108, -424824, 229200, -11238], [20011857, 1306522, -423174, -279678, -256488, -659877], [8413458, 2623365, 4568064, -638022, 828192, -592242], [-7954662, 629602, -616812, 223624, 1748464, 200866], [3854438, 2393962, 3269510, 1078273, -368304, 695970], [1071676, 2436516, 644056, -522704, 901504, -533508], [-24362921, 1740042, -557980, 726645, 422744, 290317], [33459486, 404808, 418256, -925056, 317664, -1393800], [-39150525, 88085, 5180010, 1156740, -312120, 251169], [-18014412, 2515320, 5404272, -44316, -164544, -115644], [-8510996, -42806, -3344318, -110027, -936688, -741100], [3213926, 1104104, 901920, -979650, -947360, -799974], [-22597838, -5598158, -3537068, -93776, 671216, 342266], [-23264839, -4869945, 3703286, 795480, 335624, 542531], [-64703082, 537767, 2788044, -594924, -625872, -239550], [539170, -3376136, -316440, 6750, 62048, -72306], [-24956185, 4549431, 5152184, -946821, 848216, -388351], [-29645447, -1144668, 1437680, 26013, -57688, -127421], [13698843, -5909181, -389330, -673362, -18648, -788727], [24186584, -594522, -7907844, -234054, 843696, -512820], [28401799, 1600113, 1591426, -407216, 729016, 917049], [43790442, -3947220, -4399480, 1031364, 362976, 254784], [-871560, -2761816, 275160, -117684, 878176, -997008], [-3695092, 4652584, 2319320, -768404, -882048, -1416720], [13430602, -3417048, 506544, -535014, -829824, -798978], [9280749, 1339775, -2184132, 75563, -2064712, -740293], [-7467165, 443460, 4317192, 1235979, 386232, -63279], [40842301, -5883221, 737254, 1130248, -640472, 351363], [-1061871, 2382834, -227836, -647073, 286152, 617139], [9877500, 4805538, 7139220, 598770, 393936, -79824], [5261953, -774493, 1453582, 268252, 351736, 390315], [-21406794, 242184, 1661400, 69210, 1368000, 176010], [38606006, 2317860, 7560904, 153204, -977408, 220112], [82241001, -1476749, 5661486, -287772, -1132680, -773613], [6602502, -5636662, 1044420, -8824, -619696, -185974], [-22993736, 1640251, -382724, 986110, -1312736, 680352], [44249628, 3190566, 1437380, -558864, -28080, -125526], [41503783, 2713710, -4267676, -887235, 750104, -840683], [29957564, 5237340, 2771456, 285324, -706528, 1275044], [-18027869, -1342818, -8869156, 573789, 1313912, 524689], [71423012, -2058088, 1264352, 389096, -196480, 146616], [58453704, 322312, -7348608, -736104, -910752, -370296], [-30183122, 3989304, 4924464, -752184, 605664, 1047960], [-17214297, -3012375, -10745916, -782847, 383256, -109119], [-28173717, 3344493, -918342, -424236, -267720, -269415], [70455275, 1008257, 284762, 471656, -85768, -470067], [93239689, -4133953, 3670942, -1185016, 183960, -800625], [42061872, 470940, 493392, -1278540, -239856, 218268], [10831819, 1585080, -4160248, -644829, -1919368, -71639], [-22020978, -5020444, 2034072, 355248, 846112, 1799340], [-67518667, -2370843, -2309452, 75663, 882872, -684301], [-23022747, -1794072, -2823928, -2315331, -1220184, -1183713], [10642394, 4647493, -1331464, -413218, 1895648, 395622], [-24002898, -2537594, -15826734, -457337, 803680, 195706], [-26443903, 3408378, -539636, 774483, -1348088, 1168739], [-64797664, 2952618, -147420, 33354, -1471440, -272136], [47222197, 3624091, 2241382, -123764, -398024, -2462121], [4288402, 3726406, 6831778, 908107, 1092848, -227194], [-87634902, 2605643, -786108, 1126500, 779376, 156414], [10873484, -9477112, -1426368, 784044, -1430768, -193908], [42301303, 6393354, 205700, 1432317, 867032, 899797], [-9334735, -3806338, 423050, -399982, -2455864, -718293], [63591925, 1250426, -3809906, -953768, -432824, -132681], [-25330703, 6603437, -6622160, 940721, -39960, 1132647], [-62062480, -7782876, 620984, 837728, 598400, 445788], [53259844, -4783458, 8428852, -545064, 776912, -221798], [-56572269, -8258425, 5659044, 1144973, 1193432, 347669], [-27938860, 6333192, 4325424, 43632, -699024, -1288464], [16010881, 6100701, 14170994, 603390, 902648, 782011], [64623859, -269336, 6624706, -451016, 1297336, -130239], [-1515788, -8813500, 8511096, -94428, 196864, -426456], [-123907958, -8461787, -10625096, -1107170, 1025248, -1551738], [17000912, -167904, 9686904, -828972, -837792, -199656], [50618522, 5156137, -617440, -157174, -811984, 1071222], [-9179051, 8400739, -2557178, 495064, -1572632, 1012803], [-17674807, 90018, -10438060, -1021449, 346408, -596653], [-3870906, 3821756, -7167144, 747720, -404672, 696780], [-37451818, 3927004, 2914248, 1704528, 2585504, -194868], [-13269105, 2689225, -2871678, 372016, 2701384, 1236601], [95096764, 1473676, 9043672, 1030936, 393152, 1173236], [-48064654, -2713216, -5050560, 543330, -1895216, -432594], [59551378, 4253782, 9182908, 878536, 1907024, -610810], [-38973981, 3118894, -15032190, 273696, 296616, 2137809], [-3363678, -7130998, 8487540, 1225944, 193680, 1941570], [-101087403, 238380, 3853928, -463419, -579480, 662535], [73902402, -7040136, -5283120, 2498976, 2187456, 437496], [43105604, -7784694, -2893092, -671016, 1359856, -27154], [-11187415, -951277, -14292178, -1053904, 1680488, -347217], [14231341, -7045133, -3722972, -374729, -2024344, -512917], [-49561428, 22346094, 4564852, -1052064, -612048, -363870], [98720572, -7665744, -1736936, -1688940, 1351840, -363512], [11746483, 7023117, 3537874, 80832, -3890008, 601441], [-43785905, 1371449, -6867014, -3198940, 56040, -2729391], [-791102, -6021468, -12386040, -615672, -1034400, 46812], [23738540, 17651776, 21115526, 236071, 840576, -1071204], [21646510, 784542, -235148, -1014992, 3523216, -582822], [40924078, -3875360, 2709226, 1818523, 1819712, 1583762], [83799999, 16524481, -3628398, 102328, -2358392, 419353], [23213812, -3253960, -5768576, 2988856, -718688, 3039192], [-56061922, 3485033, -5337100, -393664, 1686992, 140922], [64813417, -14119695, -7223270, 2192826, 2708120, 2290435], [95944974, -2117696, 6059376, -1857258, 99632, -2806926], [-81459437, 7941246, 15707900, -969099, -213832, -274919], [102396136, -6179804, -6353712, 1653876, 1628528, 1365132], [-48377090, -5090770, -16038996, -2002428, -974480, -2563086], [-4850577, 3165762, -20827356, 1468125, -825480, 1094613], [10650673, 1334954, 687274, -349070, 2825416, -1428357], [-13905461, -3518664, 9272544, -2360049, 3049304, -2008727], [-760154, -13637396, -12020808, -1619712, -840064, 1340196], [-33604372, 3749268, -8911096, -1432320, -1872832, -2461756], [-107339075, 9368085, -8517470, -964518, 1484792, -285689], [153680069, 1748043, -421154, -635520, 3057208, 216695], [142306338, 13240184, 16990008, 2978226, 2244832, 2885586], [-44377903, 8801232, -15121704, -762159, 1192264, -1839469], [316698, -6227809, -5561904, -1511814, -34368, 1165062], [12047746, -123494, 11301460, 3386320, -746800, 742682], [-158728631, -812124, 8657312, 826941, 73352, -1227845], [-138573086, 6378395, 24926608, -1811150, 463840, -2280834], [-63498711, 10181343, 3015814, 550656, -1012008, 1576395], [15505907, -6332919, 25571258, 2103596, -827224, 2552481], [-87821104, 2087144, -7767360, -494172, 2263360, 1610916], [-110145154, -8361258, 6730910, 829029, 1124432, -245686], [77298466, 17258304, 13296936, -147258, -681120, 1066182], [12254258, -8247996, -7765544, -978852, 2586976, 998768], [-212498344, 5560905, 14037284, -1593430, -832144, 53424], [164975402, 4050576, 17291136, -182682, -2360112, -1354854], [-113944235, -4678353, -8302490, -611636, 2888152, 350007], [-60884279, -6817848, 5624464, -1698891, 776264, -299429], [-143378909, 462735, 3925990, 1603074, 1712648, 1348513], [-76338778, -8355232, 457584, -1551528, 1912192, -1267728], [91700743, 8140563, 8977070, 3089298, -678616, 2309605], [-66678903, 3382431, -2231730, -2512392, -3410232, -608793], [-141318725, -11706875, 5039170, 1029796, 2862536, 338597], [90840342, 3423820, -4946448, -1625742, -3132112, -853434], [137792843, 15080509, 18311570, -1323140, 1926792, -513387], [108086394, -5711056, 3412416, 2249550, -220448, 20682], [-54351911, -9475329, -23863604, -2455689, 2717608, -2611793], [-137679498, 11733525, -7779672, -533598, -1927488, -2110662], [-95353951, 16876287, -1175698, -1287784, 3011912, 1089687], [-43757678, 21943468, 1828440, -291816, 1424096, 1359252], [-65222523, 14749803, -5215778, -3176064, -3899976, -4548873], [-9490182, -25990444, -11994798, -2640229, -1315840, -687178], [7749016, 3787712, 2236368, 1784880, -2518208, 688824], [59758217, -17452803, -10142638, 1203846, -2339528, 1672883], [26661549, -2829414, -12346188, 2598867, 4029768, 160023], [-27116513, -5919888, 15359830, 3815566, 3907384, 2874021], [-23985602, 2533288, 16440600, 909846, 5747840, 3544926], [-56935900, -13349740, 3933032, 4729808, -1797920, 1243396], [85987178, -10403394, -9149794, 5405145, 1007264, 2368958], [110320787, -17616599, 6169082, -40972, -1552984, -4712151], [-88176966, -22047928, -5794752, -3156552, -2958848, -2880912], [-78915676, -17771802, 23377428, 576384, 2530192, 646418], [90560752, 10159792, -18086864, -1364816, -691232, 1196904], [-96498178, -1721480, 8704176, 1330992, -257920, -2351832], [-50447815, -24713555, -34044820, -419441, 3005304, 1304415], [60463768, 17901656, 14931544, 3438236, 5631840, -21312], [-210227282, -30463058, -21642404, -2042552, -2724880, -1327930], [111308882, 5596560, -1025392, 2421996, -2627648, 2315564], [-107057739, 5686740, -4042312, -1002411, -2917368, -816129], [54419582, -2636420, 7237176, -149184, 2311712, -3078084], [-179456605, 19046625, 26243348, -2877939, 1119368, -558091], [-117716783, 20841684, 28763176, -1285215, -3393400, -585173], [-102478125, 15514494, 6549348, -617823, -1073064, 547521], [90055896, 10556360, 120408, -24840, 4335744, -900684], [-234966984, -7165644, -12031272, -5271696, -1841376, -3769164], [232834590, 4150620, 6272010, 2500827, 2421120, 2512098], [192682012, 7824400, -13169904, 318708, -778288, 1257036], [95741910, 13855252, 9527160, 619416, 909344, 4431036], [-29123113, 5632398, -2076780, -6287043, -1289384, -6749299], [37342311, -19238511, -35933646, -3713724, -97560, 1207749], [-205919297, -6445272, 4811960, -1850577, -1529608, 1372597], [31853276, -7326450, -6598076, 7334736, -2390192, 5533802], [82780457, 16450703, -5980258, -759832, -2550136, -1670721], [208958062, -14146960, -17410416, 1568880, -4781408, -2239344], [97905978, 1484138, -13002756, 4256396, 2064848, 6520802], [-15571545, -17614572, -3663848, 4505607, -2294952, 1480989], [-50818984, -1136405, -5233288, 979556, -4979296, -3661848], [161894837, 17223309, 16815632, 3194997, -2536408, 1372739], [51437296, -1882899, -862436, 1977814, 1547008, 1660584], [64663176, 25488916, 23098770, 1634617, -7237280, 296368], [-9504410, 9994536, 25926464, 398100, -1133344, -273284], [245773296, -2758624, -1536864, -3494736, 1650496, -5843904], [274982906, -8678628, 13420696, -1960896, -3496256, 302732], [236866906, 31259498, -6724172, 1836112, -5761520, 4754346], [-128927570, 17859634, -15867812, -6455492, 1245968, -2876686], [-125294414, 9624768, -24344952, 1526238, -3431232, -240594], [364095023, -6707250, 15230366, -2559982, -2214376, -3932619], [169483804, 17999048, -12550320, -3544272, -2163344, 4624320], [-114837275, -353301, -42048770, 2779728, -3374648, -3622049], [-188376490, 5147262, -1077924, 3716136, 939504, 5622126], [208332700, -56522, -32029838, 1391125, 3684224, -2493772], [77406627, 8756334, -11837116, -3537855, 5473752, 822225], [140126747, 21988545, 28611242, -2233948, -670936, 1841553], [51452853, 31178004, -3234680, 655389, -3005400, 3471], [19326934, -24585410, 11128428, -2604780, 3386672, 1706322], [33379636, 21012972, 41864536, 614728, 3974752, -2390988], [192330803, -18722037, -11622136, -497409, 2375000, 5571989], [2060408, -23898416, -22223808, -1255356, 3602384, 260772], [-50020699, 16841277, 30050610, -4137654, 5693368, -2135281], [295853129, -19322338, 10751150, -4708300, -2672392, -4959597], [289060846, -7794396, -4838664, -3621948, 2322560, -1865144], [60392610, 19901008, 6888576, -2450358, 3981296, 2623542], [-124003459, 2990659, -1875160, -849143, 6953736, -679605], [344925702, 7997148, -15937614, 3471255, 3689760, 941226], [-50437944, -10073804, 13707648, -2188128, 4316640, -572304], [-154241718, -1529656, 58061664, -788688, 785440, -209496], [18778286, 22356984, -22186656, -2787744, -1777760, -678496], [-112011828, 28265032, -16670688, -1239168, 152928, -1661472], [132401697, 7489031, 37340982, -2439724, -970120, -4788433], [-297311792, -475447, -12850424, 3852988, 6164080, 1234848], [53434231, -11854257, 6057094, 2367894, 920840, -2485907], [75134643, -9947574, -20427276, -5248647, -4125672, -3995199], [67126626, 27987508, 912696, 3182130, 2598464, 425922], [-95510010, 41356438, 20680524, 2922048, -452752, -2769426], [176899082, -19348512, 6964910, 4908201, 557696, 1751030], [-197175199, 38302128, -3220200, 3477129, -2005304, 3878123], [-250870629, -4861223, -19325190, 628320, 4379448, 7881189], [109625809, 17816701, 52611280, -1426799, 3883016, -1878649], [-2559249, -6237783, -14393862, 543096, 4101144, 1586037], [40529089, 1341897, -22469366, 3449658, -3575080, 893947], [356837637, 34233618, 50531574, 3332220, 5019144, 6759975], [-102443153, -14744724, -25707120, 90435, 1105016, -4599107], [-226026250, 7128430, 3651572, 4347556, -9199248, 3608838], [-141338290, -17659493, -11842156, -2299792, 3403472, 2103930], [196028626, -10340966, -9494894, 1909411, 1975280, 4106726], [-330255017, 12401370, 21741652, -5337627, -151432, -3520523], [-225909093, 14034057, -32934102, -3256668, 3170568, -3833991], [-344414918, 23858342, 21974836, -7970672, -3725072, -217542], [73056531, -6518739, 29623962, 3340524, -1722984, -5580207]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_147_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_147_6_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_147_6_a_o(:prec:=6)
    chi := MakeCharacter_147_a();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 6));
    S := BaseChange(S, Kf);
    maxprec := NextPrime(2999) - 1;
    while true do
        trunc_vec := Vector(Kf, [0] cat [f_vec[i]: i in [1..prec]]);
        B := Basis(S, prec + 1);
        S_basismat := Matrix([AbsEltseq(g): g in B]);
        if Rank(S_basismat) eq Min(NumberOfRows(S_basismat), NumberOfColumns(S_basismat)) then
            S_basismat := ChangeRing(S_basismat,Kf);
            f_lincom := Solution(S_basismat,trunc_vec);
            f := &+[f_lincom[i]*Basis(S)[i] : i in [1..#Basis(S)]];
            return f;
        end if;
        error if prec eq maxprec, "Unable to distinguish newform within newspace";
        prec := Min(Ceiling(1.25 * prec), maxprec);
    end while;
end function;


// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_147_6_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_147_6_a_o( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_147_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,6,sign)));
    Vf := Kernel([<2,R![-51088, -4256, 6472, 336, -169, -2, 1]>,<5,R![9969962312, -959211664, 9669292, 651312, -6778, -100, 1]>],Snew);
    return Vf;
end function;