
// Make newform 6.27.b.a in Magma, downloaded from the LMFDB on 16 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_6_b();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_6_b_Hecke();"
// To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
// To make the newform (type ModFrm), type "MakeNewformModFrm_6_27_b_a();".
// 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_6_27_b_a();".
// 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 := [6059395276689883547331396, -8410094250198512820000, -25659229618759655524, 19832313245955600, 38618090622117, -3416571600, -11609466, 0, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0, 0, 0], [117627066671777958985826633240996492697600, 18503844884559516235665654812193147844608, -11494872742795795060149698535130009600, -48893394663140704807990500945402880, -1209610537070777201048302182400, 16745556275384504378097391616, 682806232215571051827200, -1584093760565750944768], [-482635364801645747904141675118969882722798584800974, 600837329867679563926086928357927003430916173904, 1083151641318939537251344420303618545135867965, -772501875943416134598853790239365150776608, -458967971939290240835944160660190100630, 245541329519506923416385015670135226, 52290159152897806908247250728583, -23771668536858186847709471950], [851297339896747881222666111808260323430005462452233702, -677576573863881738767598752856306793858005911747472, -2078217852733308767503732097830832231449274363905, 350282011585734395569791572999715782842795424, 671676878824106020436031924378853190560910, -99323488217725276919656353238540413058, -59550776530164021130435106404351699, 10472828415467624028693327053990], [-559115823971172311224748188926193380573098917776117486, 531250469566830810685567625678662052778487711659888, 1347664420567985647843275195670772027478473865733, -455315952886567229795074604868832254666471872, -502706129743721155715089422213266227434086, 141939672290653764982363773803304450274, 51831441118402953028199918573163679, -14649123168149302896572342723414], [2247716680784567884636519779150001181005096536073452, 768779010765490740721019614392909701883301670880, -6901820155404200740310024000098268127855148402, -5955344762625162598593170296739989607797696, 1175398665764559296392627184681322684284, 1987342693549973541070212782460277532, 7490999588469613397441446443338, -179037373225328256454683461524], [806458126559182115795702124641593233597165511281207798, -996035323361372647253219490020164677937202072342544, -1823543971182979128225220514568148363096040082329, 1291841500770879335876334501583283994457222816, 774302930108036458909481179418547652494238, -412240675147550438395360601825051806322, -88268259337088648723552627636079707, 40004282257370968348627515853942], [53970789496238104179862167051957174906660695018493108, 163978460951324930396203755008784359127471991354176, -275953943049751272645586147517540288983856528054, -500971514056089067402763688715650694591055264, 65730941354286673478556807150308290522468, 158469283862685011311946053693426285708, -3657421675370141954504771289037682, -13213394915339168538561840431828]];
    Rf_basisdens := [1, 7117901822999787090974390905230393567, 1103962846407856978519824781431549940929810, 3311888539223570935559474344294649822789430, 1655944269611785467779737172147324911394715, 16726709794058439068482193658053786983785, 3311888539223570935559474344294649822789430, 551981423203928489259912390715774970464905];
    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_6_b();"
function MakeCharacter_6_b()
    N := 6;
    order := 2;
    char_gens := [5];
    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;

// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_6_b_Hecke();"
function MakeCharacter_6_b_Hecke(Kf)
    N := 6;
    order := 2;
    char_gens := [5];
    char_values := [[-1, 0, 0, 0, 0, 0, 0, 0]];
    assert UnitGenerators(DirichletGroup(N)) eq char_gens;
    values := ConvertToHeckeField(char_values : pass_field := true, Kf := Kf); // the value of chi on the gens as elements in the Hecke field
    F := Universe(values);// the Hecke field
    chi := DirichletCharacterFromValuesOnUnitGenerators(DirichletGroup(N,F),values);
    return chi;
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 := 27;
    raw_aps := [[0, 1, 0, 0, 0, 0, 0, 0], [274365, -33, 1, 0, 0, 0, 0, 0], [0, -69639, 22, 0, 0, 1, 0, 1], [22901407970, -9860, -21956, -2, 29, 11, -4, 2], [0, -1596617584, 651454, 5431, -5431, 27759, 5431, -22156], [64053627818570, 32598450, 72595610, 13840, -53260, -26980, 57870, -2920], [0, 366717289196, -2691724624, 1299004, -1299004, 3415366, 1299004, 1760280], [1656312853216538, 1447708210, 3217973480, -30410187, -11683083, 16379097, 13676897, -3118020], [0, 40263550905184, 152612820884, -34457494, 34457494, 334124934, -34457494, 111850000], [0, 529990798319691, -2599632946094, 2417669112, -2417669112, 6522956647, 2417669112, -5470285541], [-3910551161750446222, 628331034280, 1396582116540, -7766306080, -12963039635, 856524175, -7130439670, -1535507090], [-110561751527284788550, -11611658316594, -25882110001034, -118755690088, -25817031716, 70564782820, 7754584026, -10709090504], [0, 25932996017943686, -302468435398652, 5415530608, -5415530608, -295270983690, 5415530608, 751301057174], [-645169715532401260630, 169402011565818, 377559573601848, 1429242254361, 499581536877, -786300990615, 245372885853, 142875836388], [0, -253065657106040720, 255357378892440, -206540468980, 206540468980, -2665231388240, -206540468980, -1935643792600], [0, 597689948819279661, -9917423690514674, 2519546084064, -2519546084064, -7793354135339, 2519546084064, 5216323226005], [0, 3119727491569881848, -27593866317394690, 27575697365527, -27575697365527, 65052614301169, 27575697365527, -80122391070288], [29402631801094330080554, 6162066410275910, 13719263677074030, -4149935619416, -30051442672084, -7250523811084, -7602063368654, -2533435429000], [527342071638836074390010, -8373976647773418, -18628530235645944, 48572223095307, 112827823715517, 5227792508301, 63970730392203, 11955559023024], [0, -156636641904128631664, -450478646413783444, 92261686255702, -92261686255702, -590676678726698, 92261686255702, 184243127514744], [206067008708745346024850, 328523749599799048, 731737446127308120, 643165290488120, -143084361920576, -476471647632272, 685944917919536, 37043031745744], [-1172358329534907251380078, -605634192381791240, -1348821292149011860, -342358921080048, 301818663882813, 328845502014303, -1817792591174902, -3002982014610], [0, -473589751158680079488, 1485445922286531114, 274667644912061, -274667644912061, -1778506945563791, 274667644912061, -9941843347791100], [0, -2996376544766388490582, 2107241403349714820, -759665137329428, 759665137329428, 6812410886010964, -759665137329428, 6523681944883302], [-11536543378384241089120510, -4120068635364770214, -9171107325569749462, 10495072828092196, 25285895468798156, 1431916604204588, 5675503732019034, 2650442096065952], [0, -19096649239581436127839, 9611061683372220950, -5147586196787816, 5147586196787816, 19192650569661613, -5147586196787816, 32327113088229729], [66305690280805862662512290, 6116136770223455588, 13621202216259543468, 7018498436761906, -9331742180063923, -7789579684529245, 8495563994575768, -171351388392742], [0, 3310771774261858375560, -82446519216307431914, 26669783142184419, -26669783142184419, -60766369315195799, 26669783142184419, -4734459694422200], [202199233710252586147431050, -11682867546773703970, -26031960226093478490, -63242321454581432, -26308850171354788, 33391930912602692, -32446922542812038, -6633420120439720], [0, -8134766684343788632684, -32430870610472309688, 68866743684715768, -68866743684715768, 206783119156464632, 68866743684715768, -287276972117877140], [-245565674611012077924714190, 102657398132339529408, 228591555352649477628, -322261631774941884, 128071649292636957, 257531637614173575, 786945757634667558, -14384443146837402], [0, 327340842823418070935544, 386578823812363961818, -65957244717186795, 65957244717186795, -94930666053083201, -65957244717186795, -930075388405718984], [0, 594249805157084966938126, 2117549345909822627428, -725414052672528328, 725414052672528328, 4206255153367386218, -725414052672528328, 3353153796982552710], [-3427605036611838924889077334, -238293880843990109050, -530244218000762579720, 2784984744567944379, 141050462075548341, -1809639675686780139, -2758439302653339269, 216743348640258720], [0, -606876192923859226329483, 991365782178507460286, 776325752204994336, -776325752204994336, 12887653974206488205, 776325752204994336, 3152589879017152253], [9329365408123398684573977666, -2075500215830654364580, -4622883515049374927700, -5952983477773812506, 3279453106444669421, 5061806687330764811, -220264763062849724, -198039286765121710], [-25937820114947151280779804310, 2361896284582976193074, 5264844738204168692250, 25190640165349102480, 5842562265182349812, -14846239355171951716, -1620393575885829362, 2298755735594922392], [-14330643125890921972745981830, -1821492724731532120614, -4055347920482778898472, -1182590674745105239, 12396691101863115061, 4920624150451108513, 8057708842141665309, 830674105712445172], [0, -10062420369813229939384064, -25640989055681544118644, 11157412883558961254, -11157412883558961254, 1677205034886237106, 11157412883558961254, -5454468696505721440], [0, -8755947879937703575179993, -25225826634946837077846, 4646037752705436096, -4646037752705436096, 13815666303301385199, 4646037752705436096, 65798902945620713535], [0, -9227885419628163224708664, 8847355997874969892978, 18686840081096138913, -18686840081096138913, 111081678262342024135, 18686840081096138913, -83862030762603505616], [-23845896099010515815375379622, -42002689369252363480030, -93567203557473501636950, -154976338299465967296, 10070557788094352436, 106674411462342095676, -45746328136712419634, -10733761519360860360], [0, 17787113700053617366667312, -33994965328446698288272, -9852421863524848328, 9852421863524848328, -24770889800136617852, -9852421863524848328, 189395397026545483848], [-132946437173285747517736685950, -7666885229878862535848, -16989511170867175150680, 391667461971819904280, 196182481886929950496, -195717480685569952688, -79031512380731394496, 43544440285833322576], [0, 60426340026564245919434473, 139092950130487398286886, -98882270957022723736, 98882270957022723736, -368936756661863648259, -98882270957022723736, -8102758252138389095], [-180183054409607564869672789918, 52335264496233231717020, 116529559057364767112300, -122586417774732503674, -54312807459050840771, 63620009363471388859, 231961509183917532484, -13103646313613581070], [-733286534522253220687043775142, 70424320171273793728990, 156755448094965908795000, -148340426240588663697, -526461427449020675523, -76593524989281116043, -229080717865369609513, -49985322495526617720], [270944427859584318684153005810, 428452873839757434865352, 954470687343191345853228, 1718095355081089929736, -45536256229234029811, -1160575655463804629761, 436157838486176434546, 123893266581618955550], [0, 151868386330245558126458720, -1691701063430026189130718, 595042946279129025433, -595042946279129025433, -907654800542275441003, 595042946279129025433, -168408842306975735420], [257842091669778089572764496058, -263459523397917200805710, -587208259995804720490950, -3100817260110362082784, 266774117604788395924, 2156136212608504187164, 1459505464850317253534, -209929121667079532360], [0, 39435630712640563320865334, 1804994050426279322812780, -1488076076648810999780, 1488076076648810999780, -4986240619308752571720, -1488076076648810999780, 1557495934684160517410], [0, -1238375756267330127753547440, -1712545884638087621116776, 741900028838347623372, -741900028838347623372, 66194848780169634456, 741900028838347623372, -383651447645092095720], [2658474553320184783429961039714, -1004405273580508756201520, -2236349116231757200505120, 1622878824384405707464, 2497340286829922632496, -249472453979629594144, -2235454972734252518344, 305201415645505802960], [0, -17390997877596395852971648, -4577830467096138838592810, 2431126836459870040003, -2431126836459870040003, 1606441079342444866191, 2431126836459870040003, -3584061226435502738692], [0, -1474771891876140966451220480, 11300067901531045957708176, -4428158268670688480296, 4428158268670688480296, 8207599056215814220516, -4428158268670688480296, 7599313257686129981240], [0, -876296881779356238361186960, -2048723115212932345578964, -593298184651981266506, 593298184651981266506, 7643086812395021446126, -593298184651981266506, 21290089530597334300680], [0, -4213030943676317850164858129, 13879568828257359635350810, -1805106803905621425376, 1805106803905621425376, 9212384058927319173623, -1805106803905621425376, -24902660926622500112121], [16394764296608419631024467407890, 7902035431108341286081320, 17600424480977115886087020, 14886548573411793035928, -4144536447916587729123, -11305877864913391266993, 16091928935076951082242, 795704601888533726430], [22395615822877903153375661591450, -4586320409316416936308642, -10208414858421192756902586, 18703555222122697955608, 23406497492161353946748, -4666870984028013988156, -4194305095238840257718, 3119263164021040881656], [0, 4165135965721661233841072890, -13301264605597092483668108, -4554594038546004180604, 4554594038546004180604, -34669311416065090516312, -4554594038546004180604, 53503301198032964428590], [37769939947299985673616307133450, 6681991014511310109370286, 14887720359216615242560680, 43495044492651839005135, -4879583822524946496907, -30623224269276208169059, -9902607005734666720553, 2860404494083473519128], [0, 14700926732042133454753641553, 31265988533927816333678582, 5111015502825405486968, -5111015502825405486968, 166063123544302407544317, 5111015502825405486968, 16962189581549753683345], [132897820150612181620178200343450, -34264511214556766790591394, -76304936313355237598647992, -15012387837011650803689, 64474714221127459355261, 31499829965050253654213, -50580554178229752279521, 3663876028453022855672], [0, 3060059046099704643171019312, -17509113031216291234413836, -4254385609291719582310, 4254385609291719582310, 29548674692042805768602, -4254385609291719582310, 135787689032150017649928], [-137923994950546257981783925822030, -2870132135539619406448906, -6381063222097919266451018, 39324826738325205960804, 40054728389198459692644, -12864975029150650742988, 7469737345192699100446, 5879967046483234492848], [0, -36444791328981250207200303197, 99410046834722026846631474, -42257470737024310745104, 42257470737024310745104, -20805622829660740580541, -42257470737024310745104, -3482615176240067825045], [-215016047861129395371905427009238, 8104665629734231858913190, 18018224730386738456981960, -130471742696987517863021, -92142661805062598787499, 56266941196304145646181, 17155780825024332548691, -16489955889040749381520], [-205351451577519427664447345526430, 38098966822232952895564386, 84819099356911936859595586, -40975383843465925750468, -204803910350596456490036, -40951047554554868329700, -58335734648688768939414, -18205873644004620906704], [0, -105097116138868996627581380352, 288405268510018607129358246, -80976419005705344864981, 80976419005705344864981, 259488872652889327193031, -80976419005705344864981, -45551322500962594048260], [-291677465279852433330962732923414, 22298101599440886834285930, 49691538404969232488408050, 239185847255298198267632, -52956803279859055815452, -177109499263485150783572, -142520440067743525081482, 13794743998180677218680], [0, -88631244517741990655490956664, -233248226136567825939894320, 172662222000249120219120, -172662222000249120219120, 468923928627715548975280, 172662222000249120219120, -211082681232427989560840], [0, 50673014845482895147308423664, 440442753923197493825308092, -319468152458835397642498, 319468152458835397642498, -473113183976387411276570, -319468152458835397642498, 784342242736504280923976], [-1930862846027809539658132644699310, -62311716783532722674843640, -138834134429534255785083684, -500604836168091960920928, 161022361878436121805981, 387410678071540014549279, 294572767724052773211594, -25154257354789321415922], [-455243420724342968106143962572070, 49159583979529831097591378, 109249853505154731527950202, -1432409575157926132318096, -50915317028000652883724, 937967944429283870584156, 1151575643790943999739854, -109875917939698280385320], [663993962959127587251733430215562, -425676086119966305870153310, -947857126210792561818950600, 610551219242744373876693, 554342622690989544343437, -222253271931499734469983, -1481284390627932747866303, 86288432735832142090380], [0, -1259673860431682532827710096, 1683119291458217164652977168, -362801341576662944967608, 362801341576662944967608, 1135094638893683777041428, -362801341576662944967608, -1681856066076286577433400], [0, 479868640922635165277538322105, 517426740018529395197070518, -599498036364939755139856, 599498036364939755139856, -581882850754804708548903, -599498036364939755139856, 2947487442696031793046865], [5287364926875221381416349088379850, -903143345962291787938309274, -2011450051638290795738607378, -1393373913682027002097576, 1296025173467325413697100, 1360924333610459805964084, -1097204103695837281874110, -7211017793681599140776], [0, -507062810426858111801055767732, -1942040590712481339561774944, 1023823454784588279735620, -1023823454784588279735620, 2730491142368907099277778, 1023823454784588279735620, 764462137581965957351712], [2902278441878404024226193563975090, 227518317748936329040279240, 506454723551708117034079720, -1476321524167361210175488, -130272335589998911999792, 940790237581574502783728, 1800618503163326750331128, -119006952574619268309280], [0, -734656431821632760275274189104, -495065843085791016560603214, -792395961694506493596863, 792395961694506493596863, -2660468309287738616032063, -792395961694506493596863, 6217024837059186688288444], [3495300416816486556715991809198394, -446964211988390626918711830, -994400821763101247624253710, 4012452166404481974725168, 3317299534234033947382372, -1569201599524976667355988, -750587718016693107839178, 542944570417667846082040], [0, -613303072828619037572615328432, -8764091128437542067222031816, 2486898554507121824546844, -2486898554507121824546844, -12023865309918193481105560, 2486898554507121824546844, -3331350244108110456258088], [10587180722862940261699292905490210, 442057883610941146514747778, 982736139954247073374757202, -6829473374744041015294956, -5773585156128368203895364, 2628453864453237942231516, -140863132537828834774686, -933559891175734016236320], [-856546665160229839920870147853822, -912892842648049859932326100, -2034537652480256113163697780, -8113279300172139497823602, -1313849257828687974029203, 4970903114171863673872667, 578747336693699743751932, -698305819111172405322430], [0, -1136186518808118548354115097328, -5695235711571840449925191034, 3367012519050023790844859, -3367012519050023790844859, 18291162440611414128122371, 3367012519050023790844859, 10023208044817090802913860], [0, -236665223789493911115594477968, 7483118166111725216902068072, -2804730366623018902428436, 2804730366623018902428436, 8048099788581434541899554, -2804730366623018902428436, 6688258885849638644224268], [-24062581515566794918771453618922350, -6282351800249697309926623864, -13993318843809262816681869720, -18303635100695199963042080, 8049777078922928892798608, 14885682426771109606294256, -2656810301830710150202088, -759545038649797857055072], [0, 1480107762345760396597427642783, 15018625224482048637883835338, -8000276514396286663379144, 8000276514396286663379144, -18834267762724216644289509, -8000276514396286663379144, -2687212276226321084505073], [-4419116482293300185559576835257070, -87222770662523535974235808, -189114059146338138772193380, 24845097041694007166106020, 10128936009894027740781901, -13187086024497995530476713, -6127433424353418378274106, 2590669114932447030139846], [0, -2088943715710513792225907032560, 3031372575803668600201470202, -2171596347229520152661307, 2171596347229520152661307, 25898825002181811119210677, -2171596347229520152661307, 36680050695849085571452300], [0, 5235812186718632292958404492320, -16751958911108033214499429008, 10033081839736761549010936, -10033081839736761549010936, -38361747219680425333587232, 10033081839736761549010936, -71375984253879255759855920], [55868535529839970753547498959255970, -630392151874948388577923980, -1408642870548126384102780196, -18303726170043244817034142, -15181322822674168313980211, 7142043172470773773362691, -7267637616135350401686344, -2480373999460549120815878], [0, 6688605318189158066150680015576, -14157312582760166624771543386, 7476439896289431973561931, -7476439896289431973561931, 34003700992148785714284189, 7476439896289431973561931, 20702522107583545743519664], [-51682300180807761850012720224558310, 4705164468245688430833729630, 10465874832973278812198758200, -60035787448442650996823601, -29023806533131304890433379, 30349256121251332367737941, 27401051033540282347257591, -6597006961598070806463480], [0, 1492971463112723960137931906704, -16681670854295656674924409740, -4629504507137444915183590, 4629504507137444915183590, -45554956985888603898672350, -4629504507137444915183590, 54937102092867492802504760], [0, 3862586642120138452220429493139, -22118735458041162125824657838, 10509409443786435887226992, -10509409443786435887226992, -39647893176233875072386205, 10509409443786435887226992, -57254549308691747334487749], [0, -31453920411502186859594620254482, -14228333072336238798317165788, 11377531135062028810802168, -11377531135062028810802168, 1009676701821467526478602, 11377531135062028810802168, -50462419847686488747687578], [-61772041902201409403065458368848150, 16435958059885772093976231130, 36610196671149843452141939400, 26078573694254487679211825, 14153550222514354496509165, -12667865721998206953971495, 63527619097593351586170485, 2980157327168062383386740], [-130575090220078543792695453421954582, -27907491412611839026157993890, -62160516919438739212024143290, -54784236235896463038375528, 5949001531720874649500028, 38505824667837933575417028, -65411418529949821419035702, -3617424792901895436213000], [199349723636930380698458943514276730, -1751260291332551205970553622, -3904859678499355558160755704, 16774766022567386450812377, -61540501015142585808517515, -31696677686759119570047423, -90731113192593841489311555, -3315980369820385137607788], [0, 48052658514788330015833449488615, -197305833991990185666958592230, 110218670837070187824413800, -110218670837070187824413800, 137521274553450083943975835, 110218670837070187824413800, -130440538849311238885185945], [0, -60276214009079560307271073163632, 77969654988419696323735666122, 23941591612568295666882733, -23941591612568295666882733, 292349252210910814458171917, 23941591612568295666882733, -191982114786398896228953140], [0, 104966885474444962836398537135218, -171032034344161199126700900292, 18377464900472749036291256, -18377464900472749036291256, -265254097916478352398669474, 18377464900472749036291256, 178192554032518293001869802], [382979543740073647651241824408331210, -132204466802164898832161256370, -294406926678503293581136215800, -30398012251821830939859153, 247416430368724030944174933, 102737484957455897607964413, -216241009425242737726429097, 16075438379029792592912280], [-246771953048524676015200505482469950, 40319268328289214206632294634, 89772509815650738721617019338, -103048269968591221815924884, -49432856042023298597486980, 52221227965053048344787596, 175940602450402838551047250, -11294898223008482993586064], [0, 57352864486999987218859547044552, -18106388586354516694882803418, -2400198758045240371969237, 2400198758045240371969237, 391352613239478329430841857, -2400198758045240371969237, 512294234739578198403483400], [0, -34675217756932299105957309448388, -37612344411232118897445957688, 121841733886518280772013008, -121841733886518280772013008, 456693559387332780493039812, 121841733886518280772013008, -483220688455233095661283700], [0, 59821380901227923994856279750752, -262789276488120798144101305420, 28560619537849307938453818, -28560619537849307938453818, 36222476189902466516965766, 28560619537849307938453818, 750767654810863446397483568], [478765862220220019458318164806380850, -97550684117898997710401749880, -217214079897667996419867332520, 92120249336440318200945656, 216068130803760950130451264, 10609210710293437909519984, -201617063828424321553430416, 22828768899274168024547920], [415480843632739287514438756201143410, 191340510380927590741220206496, 426098453134647330792262761148, 254920406506924293453400116, -630461197044282300050741379, -380100670019376962319180537, -154590356437385650589538506, -27817836336100593081284538], [-643280665019561687182918723091038150, -29599113225062836229365413290, -66024047164005945745622018466, -494374748090622318406890952, -217155777544252162063725716, 257197906212330824916685396, -21139879811516776369616974, -52705964861842554108934568], [0, 29555224571057109190116304602838, -166701074311889884759097474948, 145085114237632226727187988, -145085114237632226727187988, -237804703775840856512009908, 145085114237632226727187988, -969179525239102867649898150], [2069957940681455732505895748044462058, -122750729598514348460099729290, -273364971772448039508670693080, -124105424420996698587412613, 268205664583144293913940693, 172138837808379230362921973, -87887223868206628754968757, 10674091863862784839002080], [-547885111331764465359672414095767294, 317870407501934474425694670660, 707864955201581204506267720060, -7054592951711866304285494, -509555214864503760724530851, -165148676320360009371986621, 676370701204311663122222544, -38267393171571527928060470], [0, -143658781314509999742297827073024, 367561000991222056259148991864, -464173011870938102672804364, 464173011870938102672804364, -978468985276166836356148226, -464173011870938102672804364, 1833666987691992939027310084], [724211712742695037817132748571583930, 146801832814687490227154710074, 327280242107494199129467304232, 1657573507120912605383426529, 644159382788603686283683509, -890329210484407174827723183, 162343409574122556547978581, 170498732585890095679045188], [0, -172902464610536204338652135395648, -1011878633337164056702363565604, 202659564045263162858365774, -202659564045263162858365774, -1737690286921945230326637334, 202659564045263162858365774, 11456696696203646427364960], [0, -406506696787231135061174578149073, 536775433601034157249855066730, -498234491302103232550223720, 498234491302103232550223720, -665526342510851629270170725, -498234491302103232550223720, 1857492614322965053083365055], [0, 253317146073182296196697837973416, -1420023402257356180289006618014, 575635454219696742478605657, -575635454219696742478605657, -278289669437912521358683273, 575635454219696742478605657, -316145536881644506814071456], [-3488730324901772954097309681009476710, 421653914392411849710304385030, 938874269082973535983312742670, -327513670768079726301078824, -1144102819596364045604810356, -163025159353401531000884236, 575958998820802982246691874, -109008628915884723844880680], [-3256670202186309749246856548719957630, -95634926518442254503062225446, -212855792653557191767791414166, 607282116379534534774130948, 301017582960495664239226636, -304515549932857801769678420, -459888722062783319361604166, 67281459210372607334322784], [0, 937065615092548049446844447855313, 1602027664857843250955130400598, 5086036397693178747997512, -5086036397693178747997512, 6434217566852602590252678533, 5086036397693178747997512, 978448187463791782133725505], [0, 133261784695905293316428070538144, -3272035448988282665352544691586, 471253548829903872877459511, -471253548829903872877459511, -5358005191401235582398044741, 471253548829903872877459511, 2005987604792369236272151100], [2490882875910693352685628425998332122, 1652108701454265370347709349490, 3679645875578845593759423829080, 3326106163587015786210836685, -2349216755078483463622339275, -3000476360750838345348004215, 1481473459623079540668483225, 72362178408039431302851660], [0, -120743933104125249488900260776445, -3876482517556952805357883592798, 1507268002376283268261533496, -1507268002376283268261533496, 1212155566876699458998044143, 1507268002376283268261533496, 1857225574837126821134365235], [-2868885994257775306918266122833298950, -1619956045113073411432606596930, -3606458563771476545211058366810, 2994633322156358636637647320, 7227196547667316767711420860, 412643301118199831478708740, -136639159824528219091458390, 757172582949901881803634680], [0, -585904520747778093807192389230240, 4822746754033581257716084670616, -3062819846831450831938481012, 3062819846831450831938481012, -6851358343493112998887737316, -3062819846831450831938481012, 2792862632323848536387029840], [-3368965487492723749459031510375485630, -1552052179529164368735582020076, -3458329753118961894442737424308, -8250366414729003948744194646, -3875992194164167999180137411, 4208246878431279966102750627, -4862549975204258157821153184, -898248785843938662809209782], [-4865647990705051705267581780687403030, -2531033301796309463945814523102, -5635893408889706947075760468118, 1245818124476840245973274784, 6340775249336607683550506996, 1283046333460975730534652476, -3562146713459156857064765906, 561969879541736883668428280], [13566892317124084808187861480151733690, 456880534033630228550617420310, 1016704794063525142558514547960, -5486010625281503382858591101, 500577873732818703699618941, 3824199708098608489805600381, 6292851814203423954524903011, -369291314929532198456220160], [0, -3890806898517908662476262752489056, -3408818705247825723910034558388, 1151863606184198129938763078, -1151863606184198129938763078, -2768631594721207188345754598, 1151863606184198129938763078, -923452896705455365020094960], [1175105884161650039704258470208670930, 786688544282497776230295542080, 1753003731921097051877165440780, 7551723401804056642553126572, -1858779303484792172142391027, -5654075369030968485749548057, -4388478118786496878604038642, 421699562838464034845239670], [6173884094087721478104308428513846490, 3483378275508448172712048401866, 7755511215127345020174161352210, -4147177476873724403107569520, -13774550647796876882733228572, -1826731898016476025506029844, 731638340488138604308719542, -1327535416642266761914133192], [0, -4972119537460166381677008978976766, 1899537878466011143496888475276, -1954894452864615191791634656, 1954894452864615191791634656, -9439842456418852187524495094, -1954894452864615191791634656, 668285187580525934216529986], [-13566322880741388956574563793539751934, -105723139319271759884049582640, -231178441255080850133172694240, 17029065062034005117744559464, 13300782939628394379342468976, -6919115728146538618715549984, 3042241689486417149287271896, 2246655407530548110895335440], [0, -1354202160070175350873355588998663, -20596574148715417580389297199898, 4603688888492527996726458808, -4603688888492527996726458808, -25950275100933464398404876043, 4603688888492527996726458808, 6035435218934561896865978905], [19703178843953136977163712209887948570, 3466335021064559036923727454722, 7720683679259342727306846001848, 12291437668604792318088952021, -9355948560827647115610266251, -11312941299345743917262723431, -5826723692482768596691787279, 217443637613121866850273020], [0, -2546149154255357322261135961693909, -8620984027547951525618905646478, 10542007714821168412021902088, -10542007714821168412021902088, 55477004024737872061394146127, 10542007714821168412021902088, -4669103272948742532578479445], [0, -6764131047552017694786379526169658, 10591080695050892572445646572516, -8009643297038895931045040384, 8009643297038895931045040384, 15123486608370115340785922830, -8009643297038895931045040384, 50521610783212628298034343718], [14049428173208818903606156440418580906, -7562968416443812835510959928310, -16845483926328382182075047620920, -17520192559682419712089707783, 6037845109601986585951265133, 13692743409655608670043560233, -10663590996375706483755458067, -850544255561513564899143900], [0, 15343005750143659989630377703747661, 3806919948520762098329963009534, 2937467028632332590704082536, -2937467028632332590704082536, 32080813996123412696813584209, 2937467028632332590704082536, -6320798853663394149119617091], [-261176138345389740032578948386943870, -3657589359536390279796720253260, -8154629360805830439875666998660, -51764885423421887159638479950, -5387422579128471711498432835, 32714116089238434202592842355, 15823486747822054205169481320, -4233504296485211768232363910], [0, 5784489574982218841687910016424680, -18864068819822761268171424272338, 12675267597838372486885565903, -12675267597838372486885565903, -3758337676076076219418204323, 12675267597838372486885565903, -50340658587568838964642894200], [-11899979852714162732983056019399352662, 10565199997117789212547278377570, 23538576836496625459600552500170, 51702848820345800470033024112, 6023389061923837104547603348, -32460769526255921278506148292, 12483505691917467305090399038, 4276017620908862042561527960], [0, 15145179219003194679696723162667952, -2181986535208893852278614068852, -14761416923743275997263289178, 14761416923743275997263289178, -36372561692940199965434133442, -14761416923743275997263289178, 104003496260041556591115646408], [-69902840883647720515792609965458925670, -5448006316271094260524967609318, -12116932156657015863002129690046, 59398962807516705246504525728, 57855248457408245153180792740, -20314225719208388446609419572, 3759340030707772142413668470, 8685497130735181511087801368], [0, 12265747468290251832574606033572362, 40895935410620462583195996124524, -671521846813080222019908824, 671521846813080222019908824, 124954182727947708066186707294, -671521846813080222019908824, -10177662981645079105897122830], [53980622748977519718199597244679219914, -3820994639854512168485943017710, -8511219801274551707928294523880, -27836539473782572334019808275, 24417847613629001262466731405, 26696975520398048643502115985, 33019756504465955786090953225, -253236434085449709003931620], [0, -22270342899673480180417825184082896, 8207640315138650516035997360480, 6247196267310046865119156400, -6247196267310046865119156400, 76417424896144913274006892140, 6247196267310046865119156400, -4997465965886636238262139960], [66525677753547172790933297229232902410, 5908623729654126568586304325090, 13132102873977376908538214965354, -106862798817511662609718901312, -84360856710250578192500321356, 43121580308257582342312493756, 761847929208625800628973966, -14164715224278684503868090568], [0, -24154482660529821552989778031290988, 88202035223930038019836202901160, -31136972106792379920962248952, 31136972106792379920962248952, 55347140609362540479306068016, -31136972106792379920962248952, 18489625282252487868821380988], [44071166554098895233886606710870391130, 18111927229926541925177792143010, 40347199406906884754825680236392, 80579027933731760417914343069, -21006438649461696447290866763, -60721498172308405761039850967, -9479709521844013426486959047, 4412784391427412145972109356], [0, -17474132547862802980134689174765360, -86849145410997666315740961450188, 47543337609799567853283308858, -47543337609799567853283308858, 163308476467545292625057158562, 47543337609799567853283308858, 62640752936580595900869428280], [141891380717999666877941559298290565610, 2431344204921920430369387785898, 5399365228305968961517246647992, -63016913013128289735323766431, -46143990150365199237626360659, 26629945291963793411007057401, 462297282714599446976317269, -8085992826925443627625935340], [0, 42004978647010499031775896911518064, -10532735751462715799088370470360, -27310883683438006001676906284, 27310883683438006001676906284, -62209096693294595926046398168, -27310883683438006001676906284, 221980762036467854210486993896], [-54547458457748377761131403904558367038, -29666658411382513072393666051180, -66055383929085243815338864241700, -2263223622948161163558433166, 129314947458481082308184703581, 44613798234792468211767189971, 34420684689407031208634486536, 9411238802632068232935279290], [0, 41034735146587643403461363821086168, 179325616320795519409519857239976, -63965405754220830436002158940, 63965405754220830436002158940, 11987657724446339411457213918, -63965405754220830436002158940, -65091875664129088158166702068], [-236402935712872809788814781640777870830, 5629304116888037539297127427662, 12512985661656080275935815386270, -96825304535824344157307006820, -72876654323904483793004561724, 40257984915914734840536483972, 5946186590255460205213205374, -12570515471091024292615671744], [0, -30586915568835838782721705217950169, -98729138632323387016264036158502, 45253069134959207156297687048, -45253069134959207156297687048, -185365756144609963609603362885, 45253069134959207156297687048, -249458352599228892083039346521], [0, 77140128008773711684787781354584984, 3261380863207108314475388831490, 42672960708556425713466619465, -42672960708556425713466619465, 123780248337194135653216817675, 42672960708556425713466619465, -269223900524870436736490720840], [0, 48837494666617361186579881309677074, 165585178123638975842800013631324, -88182993666792379198749485624, 88182993666792379198749485624, -96830829322226421989800564906, -88182993666792379198749485624, 90018318688575018792164625370], [46682313208423714112003078584035526370, -6825364934265618008907487002572, -15163898033674166516945144727876, 242341328092889445117460858418, -13406228495792463871514244947, -166029628227190451368811987261, -214600434465253246306452764728, 16958155525710887499699749146], [0, 55586988354903124590471864550948416, 25277441915782028934130103726478, 2154561340146821448993311103, -2154561340146821448993311103, 119952911186057125413112679115, 2154561340146821448993311103, 16364531092679316376627210764], [0, -48200036769198221108552979604018692, 107977223991022717351575737155088, -106146552920558721193278321348, 106146552920558721193278321348, -347199278201133166224232535242, -106146552920558721193278321348, 197211698887809904974514553960], [0, 22049230650505286396887211773821264, 120608079265626294407829759449156, 8214766391797645184916233154, -8214766391797645184916233154, 530755009512665517015014184506, 8214766391797645184916233154, 52033523921350601381746746680], [185603642759555786276735756423307835250, -46000142730531684148370944214160, -102430232680205023309038535681620, -76891545912597521285653895580, 240110545367407492374747504765, 131297879064200844982018431975, 151621823422091385182637143190, 12090296255911849710303230310], [655205302169763022661644491816600739130, 133842710497176607940138408011622, 298140962745919010904916108281102, 345874446919682461640506973224, 51997312456286440678568672108, -213250527127692827534148424780, 348830595491749216859166961042, 29471982175997696468079677432]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_6_b_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_6_27_b_a();".
// 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_6_27_b_a(:prec:=8)
    chi := MakeCharacter_6_b();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 27));
    S := BaseChange(S, Kf);
    maxprec := NextPrime(997) - 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_6_27_b_a();".
// 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_6_27_b_a( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_6_b();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,27,sign)));
    Vf := Kernel([],Snew);
    return Vf;
end function;