
// Make newform 324.6.a.d in Magma, downloaded from the LMFDB on 23 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_324_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_324_6_a_d();".
// 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_324_6_a_d();".
// 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 := [-1944, 2214, 39, -110, -2, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0], [-1674, -1209, 74, 20, -1], [-3186, 1941, -208, -46, 5], [-1056, 195, 92, 2, -1], [993, -33, -92, -2, 1]];
    Rf_basisdens := [1, 27, 54, 6, 3];
    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_324_a();"
function MakeCharacter_324_a()
    N := 324;
    order := 1;
    char_gens := [163, 245];
    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_324_a_Hecke(Kf)
    return MakeCharacter_324_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, 0, 0, 0], [0, 0, 0, 0, 0], [-4, 0, -1, 0, 0], [-6, -1, 1, 0, 0], [36, 3, -1, -1, 0], [34, 1, 8, 1, -1], [-229, 3, -2, 5, 3], [-86, 1, 17, 2, 7], [78, 6, 4, -5, -15], [-1198, -27, 2, -15, 15], [-562, -12, -6, 25, -7], [-1512, -13, -23, 23, 49], [-3693, -51, 23, -19, -45], [-256, -54, -162, -24, -21], [-5026, 87, 33, -38, -18], [-11704, 27, 53, 15, -15], [-18076, 138, -182, 50, 75], [-304, 87, 120, 23, 49], [-2692, -75, -195, -57, 138], [-22780, 129, -347, -259, -81], [1331, -141, 690, 61, -133], [-6134, 112, 122, 323, 91], [-45886, -129, -21, 130, -240], [-59962, -375, 529, -55, -225], [-8219, -605, 749, 43, 281], [-79852, 354, 1033, 38, 186], [-2506, 681, -609, 8, 280], [-64870, 9, 749, -192, 135], [-3820, 705, -525, 317, 331], [-79910, 318, -1467, -580, -480], [-25180, -1098, -522, -180, 378], [-34546, 585, 2657, 282, -504], [-118817, 87, -1147, -113, 1065], [-29676, -1366, -1082, 916, 497], [-38114, 549, -734, -903, -1305], [14390, -1440, 2862, -139, -761], [11432, 1758, -849, 74, -938], [73764, 2012, 1084, -844, -380], [53318, -2307, -4401, 868, 738], [-16590, 684, -4119, -48, 360], [174260, -2718, -5398, -678, 126], [-57054, -985, 643, -65, -7], [343502, 957, -1721, 332, -1200], [100925, -981, -1251, -1733, -175], [191172, 2832, 2326, -1820, -1140], [93904, -125, 5903, -843, -2163], [-111986, -2402, -3790, -391, 1561], [-166582, 939, 1617, 1472, 1336], [585112, 2037, -8463, 1673, 258], [-156262, -1236, -8313, 424, 2024], [225873, -1608, -7555, -2002, -1782], [805206, -450, 5400, -693, 429], [50541, -2020, -7538, 1908, 1008], [737778, 255, 2447, 1916, 825], [5237, -7302, -1722, -86, 1710], [942650, 1974, 5032, -907, 2427], [-173684, -7095, 5735, 2605, 5115], [66080, -4710, 4386, 2934, 5382], [-275086, -6126, 7197, -1366, -4034], [-76082, -3009, 5774, -2279, -1101], [-204766, -663, -11091, 1664, -3662], [-195858, 6342, 19, 2842, -4218], [-274702, -7467, -9255, 8240, 7195], [988534, 3732, 6962, -3323, -7965], [239373, 11732, 2506, -1388, 20], [-592686, 6459, -16616, -5993, -3783], [-621926, -1454, -15466, -4877, -2413], [-46017, 9002, 4354, -8614, -1682], [-17112, -6939, -24843, -4305, 2712], [714588, -3490, -1541, 3302, -3878], [-1617991, 9675, -1573, 6795, -1875], [105716, -19164, -1716, 562, -4020], [-362278, -4974, -21108, 7173, 10809], [-986522, -1313, -3250, 3651, 9597], [1016178, 1184, -37328, -155, -7936], [202590, 2181, 18947, -2188, 5358], [-2278206, -12702, 41467, -566, -9474], [-1599400, -13863, -26169, -2963, -5173], [-3045389, 915, -18439, 2371, 9465], [2066385, -11608, -24086, -16440, -2352], [-665942, -7296, 35436, -1651, 5505], [834060, 14783, 3136, -1573, -19955], [-462572, -3420, -59540, -1410, 10956], [1335521, -7965, 9612, 12657, -5169], [-1889830, 22422, 9780, -1471, 2353], [-244216, 11868, 4992, 178, -1497], [-2279041, 285, 30564, -4193, -17007], [1848581, 4215, -795, -1105, 23569], [-1859226, 8733, 3806, -31399, -9465], [2737318, -1646, 35720, 5271, 6195], [-72634, 27477, -5479, 402, -7653], [1167370, 8634, -13440, -4087, -3453], [2924500, 26032, 6584, 2166, 1632], [-582084, -11676, 6160, 25198, -6735], [-1500328, 10638, 39582, 3798, -5391], [2225108, 6855, 50019, 11647, 9801], [-955256, -36687, 3896, -9515, -25533], [-2003685, -9552, -30077, 20398, 10686], [176336, -48057, -20757, 5719, 11705], [3474468, 34832, -55910, -16004, 30836], [-4597792, 51687, -30033, 6861, 1482], [103610, -50937, -5417, 14207, 2529], [2032348, 399, -14433, 15641, 10074], [-97365, -8688, 10930, 41416, 37080], [4512144, -4225, -42557, 29551, 38012], [1240823, 35409, -61716, 31799, -22331], [1297656, -20046, 54166, 37588, 4761], [5247678, 33639, 54319, -15401, -49263], [4333486, -18747, -55193, 14772, 33138], [-7077013, -3963, 8589, 3781, 7199], [-2677998, -5875, -59321, -43478, -3952], [-6684748, -16983, 24147, -13163, -12397], [3740077, 35817, 43265, -25703, 40611], [4563356, -32469, -9741, 51173, 32410], [3349632, -14506, -24194, -59866, -18902], [4630943, 67284, -20290, -9780, -22512], [-3741580, -6561, 107163, -14661, -3240], [5650924, -46104, -29136, -29590, -34008], [4595114, -21192, -67811, 12008, 14136], [627670, 13050, -123782, 16965, -15627], [-6200032, 10230, 24051, 56702, 55690], [7380742, 727, 143264, 40353, 24843], [1149520, -74142, -71027, 40206, 31938], [939818, -87591, 81717, -6116, -4953], [2935022, 46791, -13149, -48264, -54246], [2430150, 18741, 194297, -523, 81675], [-10002224, 21940, 168905, -22184, -16696], [3261256, 52536, 9384, 7028, -37464], [10841342, 26910, -138420, -45033, 33369], [13437398, 37299, -137586, 20339, -4355], [1680926, 23826, -58746, 30275, 31366], [2980346, -120693, 175221, 11764, -27180], [-8418342, -9829, -27539, 65076, -6918], [9814946, -46848, 111684, -15368, -12568], [-1122598, -26301, -26826, 27229, -49953], [-4045430, 61072, 90317, -19710, -52254], [648082, -17583, -191871, 13625, 46407], [15370154, -14289, -97041, -18310, -55544], [-853172, 10605, -253296, -39727, -3057], [-169189, 10389, 176704, -10645, -2943], [12277190, -82917, 206955, 17346, 69117], [-796734, 37149, 90838, -101003, -74253], [-6589610, 88324, -92338, -5495, -51691], [-16163124, 26250, -176174, -50174, -54570], [-13624502, 95449, -237739, -47319, -37065], [-9365246, 44193, -199953, 40106, 94176], [5415002, 145491, 102702, 6787, 8693], [-7089770, -108519, 167568, 70691, -13575], [-5671248, -97951, 143077, -83519, -66214], [-1813200, 45402, 16666, -17174, -65226], [-6368328, -53977, 185656, -86349, -16899], [-7930266, -138183, -3895, 5561, 68607], [-19101614, -5765, 295799, -24798, -32235], [-7502078, -32214, 198392, -101195, -2115], [-1914992, 106060, 102524, 90892, 117953], [-8682674, -98070, 71616, -32797, -116997], [16718252, -82572, 304044, 66782, -15140], [-1323894, 6309, 199692, 37035, 8121], [-18422358, 22553, -102815, 31177, -61489], [-10983480, -71976, -85553, 123364, 88188], [-28172240, 111243, 22083, 77585, 76908], [10186651, -91851, 140064, -125917, 20769], [-7858078, 22596, 119838, -53969, 12749], [-30768312, -107037, -65817, 38907, 36093], [-769769, -182610, 3160, 36078, 71790], [7225966, 46278, 194416, -45717, -49773], [-20917552, 91434, -98886, -110718, -37242], [13338296, -45582, -112593, 86078, 97594], [7831550, -96531, 72681, -100363, -24413], [19707304, 146319, -55198, -145193, -55527], [-17639952, 7212, 113420, 50696, -47025], [-15849592, 1443, -67332, 25943, -68855], [2642578, 33234, 406688, -1919, -151683], [-19336869, 326099, -337709, -99597, -102903], [-16502906, -168509, -140587, 6318, 88578], [17894074, 143442, 87853, -109092, -172200], [24929696, 164418, -7458, 34072, -179557], [5184190, 222051, -410457, 47387, 54573], [4618192, 248824, 294920, 35468, 114472], [10114484, -12042, -124173, -144330, 72330], [-15777942, 40991, 555997, -22768, 34180], [-15410540, -107478, 289558, -174948, 14277], [-9787930, -150684, 263427, -1432, 40168], [10401845, 7935, 470952, 155077, -2733], [31587114, 48513, -420385, 29510, -1446], [8305088, -65913, 44578, 70667, 126813], [337760, -189816, -134202, 165364, 60932], [-4542786, -270241, 37555, -28824, -96726], [-18364811, -44498, 484724, 104750, -80198], [11629616, -124008, 164608, -110500, 139704], [-16057349, 144319, 407606, 92213, 125119], [18544324, 24483, 8679, -77125, -290064], [1253994, -199813, 160915, 9664, 119405], [7446528, 314430, 39397, 69118, 122226], [-2826466, 359445, 295297, -80806, -62805], [30034505, 145218, 553654, 78722, 27546], [-11282477, -25649, 580283, 98751, 108249], [9791296, 209218, -14629, 5610, 255390], [17826753, 151854, 465886, 3838, 30306], [44586580, -113058, -522698, 81708, 20418], [20917090, 56982, 446403, -53698, 76122], [-3784910, 259993, 218807, 49042, 44162], [-7804772, 234682, 9083, -304070, -262930], [-17689693, 316974, -271974, 25790, -86198], [2599730, 213309, 89117, -257214, -201717], [3857478, -84711, 480349, -205271, -219705], [9413248, 266854, 103910, 46542, -233526], [5496768, 162390, -502870, 1412, -30117], [10160265, -83244, 41224, -148148, -318528], [-2693196, 95174, -1089926, -76076, 266597], [-841899, -236011, 551434, 100387, 60677], [-10141406, 147735, -526688, -297741, 25629], [-5740006, -243951, 457107, 151070, -135770], [-29312026, 42294, 368650, 164645, 61197], [18855606, 58257, 149019, 97860, 36702], [252377, -351510, -790212, -32142, 48126], [2500142, 105144, 232230, -112499, 158525], [-35501781, 132651, -933879, -179757, -242271], [6455084, 95040, 380312, 295890, 47280], [10052984, -212073, 676414, 203507, 219741], [35950534, 550141, 379604, -245967, -255513], [17797250, 220233, 1086639, 66206, -230672], [-30859357, -119313, -162595, -51849, -262107], [-11025172, 185784, 754824, 101218, 133160], [-29861312, 253002, -201630, -278422, -455145], [-7957082, -170690, 856949, 22494, -153750], [-6331370, 417684, -343869, -159970, 123414], [31134472, -45534, 775970, -64346, -32850], [-5909082, 85772, 299986, -533615, -135085], [-86007882, -164436, -250912, 203879, 371871], [-23567730, -455998, -496283, 40882, 108734], [17919524, -204408, 891288, -94752, 137880], [340490, 227586, 366648, -10303, 231595], [-72828387, 437556, -360844, 206636, 34656], [10678986, -149356, 356896, -260575, 79153], [-7036530, 88509, -1245337, -51688, -99288], [-7764674, 138409, -735118, 339131, 13201], [-8656906, 783573, -226191, -110171, -76581], [-40142044, 469194, -353118, 102958, 167883], [-4482684, 139746, 1170218, 430592, -36354], [2950348, 202662, -1407302, -243300, 167169], [-7907308, 351666, 669834, 341002, -48178], [-28320958, 234825, 199551, 243690, -194712], [-19990414, -244491, -886071, 132205, 205547], [10557181, 631467, 738559, 34563, -29619], [21805434, 3531, 88481, -31288, 262734], [-3796304, -434132, 290996, 126656, 71236], [-84308340, -234267, 152741, -151429, -157716], [10605734, 102060, -672516, -212181, 162807], [95746148, -57792, -222168, -273422, -106032], [-32051806, 118065, -431760, 262145, 721159], [-68096391, 66249, 1398174, -144069, -318735], [23397762, -134976, -1922450, 36991, -114849], [8919338, -454392, -1148319, -102938, 119606], [3588478, -61116, 1307061, 85400, -517368], [-41985110, -249966, 1636042, 83463, -29778], [-30435004, 111981, -769449, -316295, -498961], [45633866, -122922, 556434, 259335, 33543], [-66563712, -816588, -1013490, 66840, 60240], [17415953, 792573, 200550, -439697, -271195], [-48590318, 145324, 573758, 441347, 177799], [-17926516, -548598, 1111938, -305870, -396675], [-1482280, 56850, 956847, 67786, 363062], [60892866, -377461, 592975, 228579, -99195], [-48596682, 684165, 1148960, 220403, 107265], [-14596384, 376353, 492885, -230415, -54696], [-4584656, 31797, -568433, -366063, 422343], [-72678623, 480306, 76086, 649538, 357786], [44921264, -61383, 518529, 123559, 729146], [40150934, 181365, -571086, 253969, 306063], [52588332, -719641, 309412, -382109, -478075], [28579884, -168418, 1676710, 38366, 263458], [-86127505, -79248, -21156, 436720, 8420], [-79197994, 198945, -322461, -482984, -119188], [-14792581, -599481, -579285, 267303, 25521], [-21954400, 145008, -774720, 401668, 709040], [-17308930, 1343619, -976993, 47940, -134670], [58583630, -464349, 729174, -116105, -552775], [100212455, -15705, -1039806, 395937, 13311], [-55197840, 252609, -175763, 152053, 503742], [119013970, -339465, -1535563, 598780, 343644], [102018398, 477987, -734991, 35866, -326530], [98289562, 466440, -274702, -671081, 300465], [-99865882, -478872, 45351, -93016, 328312], [-123066532, 36396, -251604, 273088, 209735], [17824504, -925233, -1084077, 106037, -331119], [-39097778, 422059, -596857, 396675, 257013], [1170812, -355614, 1380073, 751346, -10458], [-45410962, -815019, -173217, -200956, -546062], [30792177, 371484, -1623903, 528678, 9030], [-7950344, -426687, 103584, 172337, 370239], [-91724254, -184140, -722272, 512595, 1213092], [73564041, -1151436, -1026944, -552164, -233520], [-49238776, -884325, -642969, -163829, 161442], [43445228, 494604, -368703, 39828, -674652], [-10243958, 249210, -202409, 255906, -520578], [119228518, 553942, -2637208, 341763, 551037], [101658650, -495753, -628424, 153719, 191577], [2383924, 992496, -910224, -467056, -481968], [-52301690, -973385, 1653515, -346764, -913470], [49132057, 804670, -698272, -762754, -540014], [-17939674, 424005, -420999, 338485, 462363], [4919192, 662208, -463992, -738296, -1097200], [109361214, -122325, 2738867, 495872, -144930], [31219050, -481867, 665737, -587232, -172602], [143904326, -897909, -598305, -451069, -305147], [-18502602, 839838, 1836218, -51331, -476115], [-65591236, -599136, -1760187, 395708, -137084], [21437266, 1294263, -1478327, 407820, 114048], [-135222596, 1224199, -1405063, -558557, -338923], [121967826, -1038273, 2942777, 289208, -63690], [-12348780, 453357, 2053515, 435273, 638391], [-118247946, 2196, 304551, 1326594, 623082], [-181399610, 978742, 1779074, 195373, 251369], [12440224, 458586, -733094, -265698, 958134], [-1118773, 923109, -81348, 261631, 114281], [-39774872, 166047, -2692597, -156809, -191616], [-59656438, -261312, 161986, -333181, 1014483], [54724739, -119358, -2033298, 486090, 958662], [10723438, -112263, -1939980, -2065, 345189], [-55260520, -706875, 2124357, 505879, 140996], [-62547395, -265904, 734246, -717192, -848304], [-50729392, 104787, -2032963, -486537, -220647], [-13486780, -217812, 709356, -839030, -738508], [121393898, 901101, 467704, 402887, -445467], [-211821099, -1237240, 238357, 918118, -384886], [31742294, 345396, -1731504, -86323, 14980], [-47566300, 334323, 3206403, -404031, 68826], [-145896046, -1591149, 475677, 278512, -744006], [94452694, -333075, -994567, -639635, 365091], [75515180, -917244, -1404855, -177524, 255644], [-20294632, 278490, -1647623, 893198, -152286], [-103926762, 683783, -372995, 576854, 186508], [-89393372, -1541580, 1898220, -735976, 554307], [767678, -1175955, 1521897, -138574, -681101], [-147441020, 950388, 1426388, -179396, -323988], [-176533030, -218268, -1062936, -25068, 871140], [81324877, -526431, 1033133, 379897, 298527], [74582279, -1081359, -4697451, -324327, -109365], [41628692, -897939, 881577, 854433, 570195], [-123223304, -60257, -1432564, 107371, -366355], [-38883918, -652182, -966595, -338836, -121272], [-8879944, 1859586, -745179, -733550, -1413162], [-103716234, 1257905, -3056213, -1120512, -232242], [119761362, 453057, 357166, -837131, -562701], [-120690550, 16272, -825052, 132591, 884664], [187348280, 1387155, -431607, 15911, 55441], [-80759344, -1009314, -2436642, 85782, -322833], [-163984194, 702798, -1795532, -140561, 281415], [-118689410, 2129352, -759100, 858400, 309648], [188613006, -146266, 1698370, -404615, -1427191], [-219206819, -1117091, 808634, -304273, 309709], [-59411850, -918957, 425572, 742699, 291549], [216700298, -295026, 822408, -106831, -134963], [65212220, -591975, -714510, 1206185, 449095], [127498330, -1095024, 1214012, -132776, -425688], [-121967502, 575154, 745644, -45339, 189681], [-351977372, -297036, -174284, 43380, 319404], [-60648578, -314136, -2415749, 630654, 208350], [113089786, 688650, 973628, -284291, 1305903], [82254658, -979529, 981410, -121561, -1142327], [-219732067, -695880, -12280, 1002288, 1097748], [-91601844, -241605, 3128775, 186483, -383211], [-161881108, 1195239, 1994611, 591875, -150156], [-55123502, 878761, 727109, 1238720, 1244695], [73990239, -504949, 1745383, 783531, 695097], [107922608, -812373, 1413730, -811909, -981099], [-59870672, 1665097, -821779, 619095, 1065831], [-23606039, -1002329, 4059512, -541215, -1129797], [-126300954, -473622, 3100034, -156451, 565101], [32563398, -259537, 3108955, 703296, -1285983], [52179918, 301413, -1098061, -184984, 143814], [83833828, -2679219, -546860, -166623, -489969], [93835174, 365011, 4934945, -141142, -1314554], [228565942, -734945, -1438897, -1018193, -347575], [-92274588, 1327221, 2240313, -620055, 215196], [-58417144, -297579, -1345455, -846809, -989781], [-63606158, -48107, 3868013, -1511115, -1918893], [90351187, 1069713, -3964460, -728949, 605397], [-83325106, 2178267, -165840, 177865, 1074971], [-115799454, -784392, -1759891, 827780, 455364], [247895951, -342168, -2057474, 1315904, 1706952], [47822856, -2093290, -2239130, -357234, 107322], [227055033, 945159, -422297, 622639, -350415], [-106459520, 507148, -3849136, 10610, 980947], [9041384, 1367400, 1156672, 982580, 521928], [-16049278, -2200929, 3159069, 207440, 727804], [113471388, 809528, -4448615, -564696, 836208], [-97717220, -49886, 1412234, 1363726, -389890], [-64441802, -2733171, -1976949, 294512, 600102], [211562075, -2037837, 1006527, -106301, -328435], [240246804, 246471, 2280022, 282067, -412563], [206074654, -182412, 1471288, -1704195, -1129644], [137430132, -591064, 913516, -39610, 319969], [-115891274, 2116173, -2220573, -992668, -613668], [74746250, 531375, 3557208, 724557, 1728231], [-11984724, -1037305, 1516339, -1157049, -1641879], [90553063, 787089, -778665, -173623, 231615], [-191536996, 180942, -4179606, -381332, -1259683], [-16014624, 191145, -2970460, 1483625, 467679], [-146633950, -299016, 4501215, 1111104, -792360], [320971767, -616719, 2768464, 397291, -860211], [25337558, 533640, 1681134, -236539, -505907], [29119906, 1108605, 1921224, 459239, 232245], [-199566946, -2494272, -230484, 1645144, 825144], [-29949940, -263217, 2732187, -903869, 1155041], [170564998, -2284544, 3613835, -750132, 715644], [228993447, 916140, 544070, -1384660, -1196928], [258996044, 501405, -3283503, 1059157, -912862], [11105770, -2331855, -5391827, 724740, 1124886], [-125059549, -1944603, -4440735, 342789, -81069], [-149160278, -1081146, -2430721, 774838, 1910226], [378062934, -147246, -207430, 1152389, 1244622], [-26938792, 747765, 1146897, -1251019, -1486412], [-278361126, -2444359, 3491770, -276849, -452907], [-21543402, -1081785, 5338267, 569767, 361545], [-25508516, -1484724, 2769164, -1865618, 363732], [99369862, 3454228, 1473290, -1156711, -363461], [171454971, 1110279, -3850030, 37121, 860031], [163121438, 719217, 971819, -1857540, -2003178], [184011168, -1623624, 3599663, 62744, 1474728], [-19456504, 2526741, 1953963, 607449, -528897], [-111193430, -2437947, -1999841, 168978, 1510128], [85984788, -2329938, -344994, 1778214, 1855239], [73493006, 1839891, -1637049, -468997, -129539], [-3334756, 452901, -3226736, -2332447, -1562241], [201454028, -1601136, 1887296, -1258992, -681297], [-74332094, -710799, 2630493, 3199385, -635169], [171695900, -330444, -516924, -813756, 1366284], [-256888210, -1382262, -4525148, -930769, -2077473]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_324_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_324_6_a_d();".
// 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_324_6_a_d(:prec:=5)
    chi := MakeCharacter_324_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_324_6_a_d();".
// 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_324_6_a_d( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_324_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,6,sign)));
    Vf := Kernel([<5,R![-65069568, 7030800, 56727, -9981, 21, 1]>],Snew);
    return Vf;
end function;