
// Make newform 21.18.a.c in Magma, downloaded from the LMFDB on 03 January 2026.
// To make the character of type GrpDrchElt, type "MakeCharacter_21_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_21_18_a_c();".
// 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_21_18_a_c();".
// 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 := [2022689200, -1667140, -102516, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0], [0, 2, 0, 0], [-205008, -102, 4, 0], [5607524, -59622, -135, 1]];
    Rf_basisdens := [1, 1, 1, 6];
    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_21_a();"
function MakeCharacter_21_a()
    N := 21;
    order := 1;
    char_gens := [8, 10];
    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_21_a_Hecke( : Kf := Kf)
    return MakeCharacter_21_a();
end function;


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


function qexpCoeffs()
    // To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
    weight := 18;
    raw_aps := [[-4, -1, 0, 0], [-6561, 0, 0, 0], [213032, -317, -8, 1], [5764801, 0, 0, 0], [270319630, 438857, 4130, 701], [653340670, -2907926, 8678, -3996], [4108042264, -5147469, 172534, 25231], [-19435460136, -96922072, -359210, -60210], [201296082602, -805313087, 515482, -56099], [1100580411210, -2641253368, 10001398, -1927922], [2646896954396, -3275508264, -993378, 5535270], [-4857176358730, 4968871950, -203640834, 12368808], [30269974118100, 12329535097, 46323758, -67617511], [26423474854468, 99392849776, 153472268, 34042140], [106250538462788, -70618903018, -833252568, -36655638], [-41902711891730, -299700487398, -3787828250, 126789556], [36391914041320, 274277542942, 10126234464, -1644445254], [845408297884634, -108806789064, 11937348354, 1405336554], [665121050287328, -4873293712218, -20158416852, -434955042], [-1401440494426842, 5256844212999, -28901591106, -7268970669], [-2326852225631970, 1642536257294, 59221953544, -2269315278], [-14261611793067820, -7421900049066, -11072023080, 8357573466], [317016020426964, 18499878496544, 34525864012, 6047820076], [13833973754060180, 32760028466397, 53896431938, 40903714265], [-32261892430937570, 69442651256530, -710223819688, -45408696498], [72828080473781812, 83357212546301, 223568826104, -41474537809], [130935157184986964, 183129424266924, -212275846134, 41057242254], [30296545756480982, 47143365555693, -1310029891102, 59700282857], [56273629600347086, 404852126242248, 391937154912, -130180510152], [30531216945959634, -161959968331268, -478831448020, -605416131040], [-120022518393594164, -178631085473546, -3140403777388, -1448096474250], [463491621804563396, -127311773260868, -4543175099912, -887981547092], [-187699624163087930, 1810144801168598, 1271727948980, -753513406666], [-73080799332340100, -205654186213232, 6246900502748, 2430918085644], [781882609088028974, 2181938772523522, 4515387309214, -3924494474204], [-172957480041236416, 2878482113827320, -27370970116860, 214805426796], [1841074536917562042, -10799208485334436, 29493874671454, 1721286807858], [464884927063069976, -8764491351431094, 23525332973700, -6665788518750], [4385944982311705788, -18655272359192354, -55649750439376, 794865393098], [2264867368336187348, 9259731773250089, 22351591411032, -16068904006893], [12125370362321787010, 29689141505277807, -66475914667130, 13652773745299], [-1126636525451488090, -3974115241220898, 74103068914554, 5964457868244], [18612181032805512254, 24291789409490183, -75390262405554, 16642080130659], [5253435293590007138, 64816813458064662, -37870593773802, -24523785244584], [2320009895710524750, -5789180266414734, 167344617896982, 17512294808556], [26622049282793529104, 12348189219254292, -124089447225456, 8706964082508], [-5432583105237667076, 75193206943657444, 559485200733152, 36772914461004], [49829811544999428944, 82189141536511260, 817052189784516, -116677700956008], [-69834688162221955472, 217476213523125254, 926377914936200, -4379072931814], [3833123477295768638, 203094236406305478, -295578635412090, -116139120556392], [87107560320779096102, 98251950497036766, 506477313833708, 160915783024262], [38450264216236208754, 10229205442213681, 437648861901362, -171367280438971], [-27678429393547499530, 198295068574306002, -1402083840128196, 64914374949426], [28398245406739059840, 168675605367418230, -800451012999636, -61501315732722], [45886612715073613100, 35488548205642093, 2240525390617066, 181585322486833], [-225772534241216804414, -671369784045477403, 640463806265594, 45821155889705], [-279361898654497175648, -198384572587097181, -4017146669592776, -230493505095071], [295799696186140729124, -382201482291678636, 1714750167332958, -75470426775846], [-55470213241989592114, -1370407919958656166, 779322588280230, 58369842448308], [-306815586057810838314, 426170457001900730, 8115646798466056, 46951428860470], [-189513669922605176920, 1038723030073819608, 1998431539021002, 727101635823954], [-1004350184191520090892, 463191955859774041, -7282014588305020, -642969362880433], [613056819676543428328, 2307576104287565620, 4231918367560394, 167026970295270], [1057037839199816084716, -798606754951004066, 4946156636530584, 452421179185458], [-1431896383710706427718, 2287681488866721584, -5988412756144760, 163442404262808], [58346949788191269902, -828783936562858630, 708747900800610, -694769354894256], [-125175823863165318300, -1769980301444276764, -25907602410656672, 2654411137740], [-1767256066042814517238, 5637395845442609172, 27756870217052400, 2039820076336428], [254549471548591464370, 5767650248630531683, -33348653234109738, 608149693680831], [796795958101145435818, 1465145505893733856, -15814843977706294, 785329292789802], [-3738107887380251712824, -763399493217345373, -19787256740990434, -2843440747284217], [659932372456431594254, 6932096722554327819, -2284948423288882, 6593552774414063], [-4925568617536611844128, -9031141361875753288, 3775572081517984, 2317973791534920], [3408046043153402827398, -10381707681684429928, 7942814454676528, 903977061016824], [271459916061469373620, -2530747956186079676, 76342416018225248, 6422356334883564], [-734398883620204242520, 4394429127479930668, -46280470476095048, 4331210076797884], [3427434143227692590578, 10984473050551210808, 55424291760975638, -4967816625734722], [8994095689285102395914, 12920804464631482452, -87358686937912938, 14917520667765330], [-4225819681107136273882, 14681780618113027738, -13518873113441948, -1325131289390798], [4195001608567932099566, -33074232148204324302, -148608247083986940, -1054914152761062], [17708098690318520756952, -12212442065630736602, 2094701412868484, -13467422774684938], [-4228145276189648982754, 16988722648728649794, -131921937862871634, -3272005395477900], [3759057889989729959758, 33583226321788937943, 63834843585296230, 15781053920871787], [12384738059632046683642, 11232457148612619604, -142066332861870832, 5738019506524044], [20705387934111265791792, 14887652478305428832, -63389532637849364, -23950429525761012], [-4230658629293474678158, -38209678493539981045, -96510731345840010, 17723346941725143], [-15358726622294391291054, -21949494547752121920, -131522263173303480, 33300350872905096], [-5160457810441674590038, -103297189460153419968, 206507210410553712, -8101053711697104], [21514355004840579261996, 4974894263157820241, 639209707729132, 16111395807346975], [-9698519434775703703372, 27447089574089042874, 124461828036603180, -14912172295468326], [-12023789966074124543440, -57351695612796013878, 129294049323438404, -19514125298608606], [15571906099361466193828, 133009223719552743722, -113092627030818220, -27952247564703406], [2398029165295592414568, -234715145846449469188, 122045000715114004, 17227487396356488], [49005842383372979498298, 132605052955541684095, -33625486039237354, -69044730936325165], [-25101311959846306324060, -125920712961186235140, 756637175411712012, -39210034298264640], [61722576775708376310000, 10793526853334082168, -33855693828986748, 29842270120815468], [4764487703293244584064, 23415966835503143239, -13029550256679212, 184834104815739625], [24977893811819882777464, 183483976648933002855, -1078159058050436738, 78460546195197235], [-77907871414243075606396, 138377335875520822056, -202200710615836560, -129615949641821976], [-133916454892097835122730, -176701487348784964342, -910265542100272826, 168217829821935972], [26905436000404662662584, 146157278103486819862, 385551347810536976, 33468030116330130], [-18237730678910186070338, 289218945673156122270, 75998539686659302, 77282225623768384], [62761991872173910721320, 389908150953622877650, -106261924703304432, 53090646845975430], [-224772944477865925162210, -354833222159629148554, 1209253980429523176, -80288277658598838], [-86913097201322104473096, 457977259144672975418, 884803620608954632, -106642569195490698], [-238621438530077048211142, 131865181172305331340, 1932823920032342520, 205467249809052], [-95201265754817266381200, -961619717742787807606, 1400476262761475536, 90308768615984110], [117956352371442344712440, -85750595042077331025, 5026054408784177738, 59148528762203735], [146842466500188320785918, 290593678669521391243, -3071772089543745978, -164003622678371481], [-27116420882798587797998, -589944787680144339860, -113596847812841176, -208479923355243924], [-40251124991312632936104, 781235581464102971048, -389126264332193036, 423003877409664108], [-144030884364449547651730, 38490064372615903680, -3684072644476548564, 366487768875685356], [-65940178737508837722138, -124385910584553006086, -3918056740410462232, 227661370731375062], [398673887141542609611764, -783568819274069731260, 1935870279860522676, -63430685606934144], [401854657005905825926036, 124299614155690103086, -899970681832864324, -1079423792036576442], [14785161386296467309046, 1631996808237979459430, 597033151638085472, -134227826379872878], [151332946427860111009288, 618401010340247758720, 1447523441754552374, 452448770056175286], [400011277683503021080132, -311592547129803875670, -3636526435273087808, 603331377814016446], [378231803871703890123602, 347100326411715533140, -1431474468345969794, -252614337366977414], [754424453727410831478822, -961896237060489394615, 6880325022088369114, 24340455182471413], [-82841615433714815980158, 1518325177739412256004, -2413473107700849242, 567066795462003186], [-861731949670223772590206, 1179241333724246130786, 2629822986505339026, 522068157114123960], [130901068501950113731388, -3058730472278063333215, -5123433121490875944, 380998190210212347], [464592041600898519408106, -760034784754541759361, 1070534477418334558, -1212332794276881125], [283713018777835021495316, 1578405174048542534844, 2135605158616500456, 442084435738144668], [67890822883197918160122, -352532677694864781744, -1300287961811352906, -1218771762463918170], [-452438074671269627627530, -875612485090506433488, 3909436665954215424, -219688624074367728], [809307120732340621284608, 6621116419883720904, 1688154378581229704, -508353101064005536], [-762667229776088414133836, -1201623584111931286508, -24760948213706931334, 1409683331803606326], [804996386267327128627406, -643223906001599164830, -12031488833376103866, 339511778501848236], [420785513348030338507160, 1040667145574024627322, 12911238281298296820, 3549635427159090594], [377753562583411937989086, 3287865182619109051747, -24901947099453397810, 698972781434708471], [15628985719106999627088, -962583056354841285088, -11103665786346353816, -1923840657775073592], [-932513008550179546190042, -2812034182840793028080, 31427578887303587888, -1669829054249519136], [1580879186477094845887700, 3704173801249479050509, -8797513804550382902, -1943722136851471247], [442819565158527847331402, -6408911076306820844316, 9204194959331812944, 1026843473504083068], [40336557316813483186012, 1288546384394128775913, 34618713378208014328, -511931514139803533], [1524156147266868112938956, -4148710597522477044972, -4564600481714382612, -4476057475908571992], [-610989688616157828834540, 4432096292961179960137, 17784787855941177344, -4949375818397674213], [-5783222613932281697347454, 5400232799275884407424, -7581192800884940180, -322260137249193236], [61415305640290027208588, -6276722684182018754052, -30005504956820917752, 795469844319222780], [-2598637899719112397694458, -632979660725201365114, 29778762185337980430, -1153604163273202656], [-1501971468270270002015836, 9867413844223109954346, -16708246978410741792, -5143026127016438946], [-268282873971980957586018, 1206017989478342068161, 29454231318006586098, -2953725157212262539], [-1310419926691470899255058, 7451630242618846628222, 5285028815088362242, 3529395974431604412], [-740560065958208651283204, -7489630461641535817438, -38762403231443571260, -2085998422415306966], [716260105020128369548370, -1064166125359797145728, 66917083072435512354, 9123670552299258978], [-13474026156043570636687052, -1517760301167701228443, -6382516045373402350, -2894825164952892991], [2321859915742723474829912, -38379012788042015220, 38215684328682697902, -1722351562326081198], [-1100344939698923015504590, -284323518692512438623, 94653576062902661666, -4349156630532302587], [-3693770794832024323241578, 12015108720301725377568, -58285139996926365300, -1274505025829886612], [-7216209536779575002097888, -10279078055785692711429, 22947103010595034026, 2357932090844112795], [-1209249845720914149074380, -3359641868372217919116, 19944178027853111868, 1020078833816587608], [-3242334798757045150969252, 15287437674875811217078, 33500841667492373920, -1590994180575459134], [5055254371520880280707860, 27829397832622437260760, 47255968545017665188, -2448938816910498708], [11504719419782993650852782, 3790073482509781401047, 27770861255184467686, -6422322682148101397], [942626184155819735112680, 1716764723371641679332, -87263150902648595268, -32178805129626856344], [-12453261944271570310736524, 26783939578049198425301, 54095254832149808142, 8835473646322608909], [-14348147120193190585581110, 17068063017610781563684, 67627082655587503124, 9518190782231617920], [-486582011410723136291648, -37000913795781294041033, 13525771545035711748, 10742101900137650025], [-14662026330228863085503338, 7394172968130174697481, 70802155117239883746, -8300574005573674947], [12167044725162769868995386, 4337069362871883109944, -81581978772017473320, -16190778344552615808], [1528213041124457817060772, 4802534604130468840390, 151656425401509660188, -35441594016616237842], [-873562176142269789824644, -52750481474096190932208, 39577414613917313252, -25867621788671987692], [-1803368021404538603016986, -26678541408778531680902, 11290083326307406116, 29425175510031819666], [3404964041609712377820856, 16671894984454938266348, 12891064038477683060, 32634574073686093880], [-5953485028698114494231776, -43556639693676310698204, 161008568253087221028, 36461284141618496016], [16348771444117405437577442, 694498027175599698732, -114471421359686897898, -39115785540349376550], [-6531594227339629367095118, 73196891581956684704722, 34488632877679203554, -4696526786929252776], [-12974391774954993977615884, -38469338563705292344199, 11355082041142626676, 12935907210594597919], [44440583070401150133166, -1359340777407267166135, -351575293426978807966, 8030406960414295421], [11202818419127361486683978, 17951026047257115403812, -99095876856847845090, -33118476195541385142], [6986539590782533523699246, -12675869316528731278733, 317849984509767673966, -140141279259520697], [-15242562022206600347904318, -22750937220236556911590, -253796236043537599994, -35509619871276206508], [45193485363231732588237032, 47239713536386005818532, -182307184058262518712, 19823134531419064116], [30022455846186290475805152, -32787227400163235769953, 103511187849784759562, -15354242494659415321], [26558353461147827612486320, 45553705091251912868566, 145272430577455242632, -22752764177913866934], [38114695975476143134125538, -20945654797571711455200, 588403815286247165398, 19342468351820563510], [-12925128276332148851139164, 76890822178233059238328, -240170035304673136858, -27197783666589000114], [12678616822554424431403274, 36912825012425860167780, -413120223025897199538, -41839408576647746118], [-37974710343573982366950996, 117633065810910433537442, 187913973275232888448, 51373369075992818022], [37113604643494415532234756, -43563057722391983317468, -659730551805653020808, 17399103290559085540], [8540037047093833674580702, 55479177454999943221762, -750450640518525664090, 45194044202430294060], [-57595938536847685263960664, 51528123557324282452155, 669138230770467649490, -1334790803974198525], [-12482945800055622784172774, -80217525949790011243907, -557658111209380653870, -58224774431261116215], [-24530282101019397078447812, 50525063406484838877485, 25742580966903972332, -46591895421294897229], [-41624605345147555443508594, 61043553527967864032700, 781575350066422142244, 14008656130860180312], [32411465079323495267592588, -64635041605460143579072, 458235678048713975488, 43874824863046572288], [42642333229368327242499026, 17243904244668481929978, -195478359263453931570, 32935857206675615676], [-33825180365950717401260816, 47020827203121246887484, 1013178724081342397980, 17512552835687891536], [-16768170640571596326578538, 32900111791820525158994, -744939856944774019652, 17225501147052905394], [-24708633716389185151685730, 85234195083355546545185, 569097327701417874010, 156231006666072813565], [-24442958712952379089356124, -140229439336264056038760, -18796573257880823448, -133268462738832555792], [38928076087323212512424060, -145824662010973440208687, -1136046953619172898004, 37369642813104520671], [-132119249603518064637007106, 151415481083345303785845, 594063376709704237618, -10852125545608732847], [-4195143586057262737608656, -185447894999913465227585, 425697439534683716490, 87871868843395785927], [-68881099078681686555479454, 56288673662007715633010, 1055082792944775765370, 179182870217966406096], [184435302132985239381990998, -29279149066290329727846, -91461414943855143714, 98201469008413881900], [57902137107997240927199172, 28015674414694471640021, -839652332421828065570, -116417528278878443939], [-27977007233112443038174108, -169099745516283700610478, -1452040935717945696016, -187156437418409141146], [45436899435289283826547966, -112135227980872324379006, -996640458318354156534, 198838959962212257552], [-43443699623552069616867104, 107604472119785722053196, -1975700534706844493908, 129076461057283213968], [49983984800192331480398366, 9253749812035805900322, -816379566255727483614, -260727916892611678776], [35461293786000714321095966, 29732122183528130508474, 142972658726081502792, -271039647083637965706], [100204192172967961025494956, 7377469049953133164452, -1123310414346563811312, 1123512357134866428], [23435132612334449699194948, 65307651933715085873037, 2306730685073582537764, -99448102857249712757], [-73038475986665225175879568, -3337132102067896921404, 660814724954402673012, 207267468620177790144], [167322319811081912561195270, -128297492265385843750967, 1826386681041485428306, -60281421421301386259], [272132042676739628696637618, -225807936782763561981328, 376926535794173646724, -135430908941793061676], [98333515948814427332417048, -408513704169115237486284, -2939031676283294684466, -248584496854594046742], [-336496162937350859202265630, -24431762530151988944760, 117386048795116312224, 118836997760104080696], [78779813530898863044994800, 651963631062801527175739, -672356513087939552692, -191767057356586385731], [85289884367916907171690744, 101958230076210898018876, -101444386471860633244, 211227399363511986840], [14191713728952769798990388, -146971616334442629656872, 3511166520818175531216, 96915309698340730968], [99864240398175644811946996, 449451618554307981567190, -595289781050380707924, -79208330111408614482], [21042451484231694999195002, -453041694512328379701132, 970923678619757078916, -14137708146904845216], [-201635658438123548289973296, -495755382605361980302420, -1548562097117940576692, 287998102343810912976], [214028497615173215230813072, 423826341148951800699635, -1169842861747538935246, 109534579519735208843], [-42360005265080012508328798, -743169656746498398165651, -3358465704488866882582, 191888545546849447601], [252621439134077494254460554, 673511515600033524842584, 394433829980775716534, -214504339979053065538], [100162784333372552740980998, 74050684427773239357240, -1059421056308940163680, 354038625474623422920], [138997771122502226456657812, -1223290759628489019245156, -2573094466269601754854, 321371087970188332782], [281426831984449423598929610, -686131509061923668078852, 247727987159691530848, -623872866822179379116], [-379414549289864195503965504, 689848788607245077331800, 1470279135545329298008, 371438783990287880544], [-327569042296881001318088244, 176742875421988256913604, 7016362231206198520940, -493356694532113720264], [294809619770886061381127302, -879811772675552985875234, -7387592289161048434594, 99239220621326413944], [-238032837341361585017375164, -241281589586479356147103, 1032253613343072937374, 658269129907600574145], [-143082865805783845370214806, 129297855531394575882525, 3176338374220561890370, 1051870731183499712281], [-245723717661754243468262676, 132009856337380905849908, 3163395813787772068342, 928410310378875639186], [-573836371874591011826146534, -559529191670591997191689, 1221241836484736957142, 27224097302576849787], [-147041886938321346749116290, 1911344450155375930249256, -4030838873890886948024, -384712402585252105152], [-556048645496813661381420552, 856185503717207589394484, -6163751507609059897622, -751908178846786148730], [958470447379707970768391344, -255858583481876904355700, 1847365137576506707508, -294704879570896843944], [-288919315938649569645253046, 1570010281439874006507304, -7338381596668960971672, -15539405590769509920], [-225484050264345738746392832, 964296474676781662310404, 2732946611666076074042, -396769705631405430714], [207323323795779759316402912, -124687390086522162683008, 2988156246382563393944, 431047957257498055448], [-45410549732072765617363698, 14113841593509258543506, -132278550353741069528, -490093267828244452002], [-548029714413052884652255258, -1062062215971961636458234, -269636325173687168098, 816934630872200569904], [-264875118529951947073491750, 512408436125844956164399, 61866449280157960478, 294779010073006190315], [-237621096360703588775917248, -397562793998684589419400, -4080712883387744502108, -437020121828256449652], [-558497301718782840045957422, 261647015433576179498279, 4169035283875299723326, 1754467031495224631795], [-33001674763126099299696228, -622273572698955030457204, 4390901689246864769224, -304327354315304800404], [683702794990340184755833848, 414810392399715331648844, -1690075677131298907004, -1407052681429219390872], [-468899614542158254667400058, -808500191045855750375766, -11932202579806101169434, 1455594917876732544228], [394770734287836564079544916, 1182906838301889478773457, 1984457467112959384730, 1296965595627095943437], [531730657369256452485307844, -361313979194771473943770, -4844223527124391789260, 1277643553465330178214], [566358975170922215810973052, -1900439280196602781995800, 9932827575782999188262, 321843869036620090974], [1219048223503997583958646656, 1978378542522502329674062, -1334532969609014955000, -211668617282098848654], [-387774773578037840833682568, -1944759173669422481699254, -1937258285863876447232, -3349136782724840844642], [-1683922836495972717854178438, 837570792030132325785933, -12071977027488305178774, -917095182722290883247], [-70433018884433786837573186, -1464539086061541327670436, -8720007164732127691444, 361727984223558690912], [560930100514051901859915512, 764509150967619360032631, -3263361307859500821958, 2008279783811871008159], [-387969025178142524802231866, 1676555531103297900443263, 10061578498119234127926, 350145174144733588275], [-347929546532012462278826450, -1759380398125692020407274, -7503627646870747917544, -516444352772244661926], [511172994209976874701420100, -2090576780862665890713583, -14268997823805986217088, -1980843674083178391949], [781471412883456802669620854, -3637903016481114863175, 7158924838399231708106, 1954755869667671716277], [120491654207858948111995358, -2321954202928721008255350, 14598905493435171418230, 1460291997438244498068], [553487544390951173402465192, 1935974961068898777972900, 13305969235862910249870, 2067220273665743105274], [-291774406873753624460699316, 3115695587553921227306277, -6417962537531357324724, 167532159278038571643], [-721942288562920565414766294, -78159458877438607574380, 8094078384387719157796, -2092298272319413819296], [-589457940843692445353460588, -1344943511579651179439674, -1449199478423016443864, -1960356890711219829894], [-1332228930202538391848705814, -2726915441339753894866501, -20337707273205454933274, 1347560310934471201111], [-2252167933382636334298218514, 2801025936935998841450358, 11615690289444635908566, 516304392676669425528], [1397886169349091756819737962, -390043002685001301582704, -21641050499050148846830, -2544073236345965936382], [-1557059574041518877560579088, 2714994230185733328132979, -1400818466823709612374, -2399459745955261051773], [1609455809864119791918957308, -312819889773829288039788, -15867925661717958221628, 2242241599669124895360], [-1354834818933059401872509010, 1843898811371470074145470, 16474102815528751188654, 5980012821514840368744], [864290908446937137973355544, 4236586039752515427191039, -3803283163014758301722, 5875049646234185162467], [1638726667230804797181046832, 7024367572212160746109998, 6515585023603119273648, -2583827405231745249414], [-309009889933600850449151150, 586578931205049675010936, -4950248161765571864394, 3387519963840867570462], [452119647160082454278922690, -594471345008554043780704, -29365074128201858517218, 3860120072284748336574], [1208954606449539940996055684, -2583029316226221097183200, 3754208900427403788552, -4141402517413585231704], [-1892058732290476596628764802, -565597588723021885903698, 5298679522058540396448, 190859554059716883114], [-130771995776510409708687448, -2242355782850426467171308, -16278999211793195129184, -926982078564511816740], [2853272186471461341852623966, -4930601523815257430859402, 4742271094653208148604, 3330782137791653237982], [2586590775555759087527094596, 9865156832572078989243516, -16968210122670095321742, 4341531513901784758758], [2990947322719957174182668798, 1534238789696972796090409, -17683290975659995262990, 999474604054422346285], [-1106406424008394671408561706, -5246283820711583680807518, 4206597320123766390654, 2152787706751705425252], [-3190139524918284525468551782, -6686485793600046933785370, -4770971939099879143554, -5976618986751723821520], [102984173406671644767769376, -2343476604412892376007066, 11080588376224583207784, -8547130651491800956134], [-81034503287258582108129216, -283746525616066565806220, 43378857336660201406212, 1749885444450882782304], [-115717589404328500052282284, -6814845519772127665853346, 26872739316760077698388, 7475487540173304603246], [-2305029085621154541834320184, 6856861371139691675230196, 23024062380975541025188, 7922220923501795535232], [-1562326956390529943314980542, -11317540552229097362261156, -44531744145890833372186, 6361702977300861256506], [3626123912889280687293920900, 8662386062315636415509832, -7182133120653566315040, -5637282628063729112136], [-3027450925634833372873915522, 2426839968312684839696391, -83028142439284185892450, -875478426568943248333], [-220572177896645180793179518, 12362784516664995205960296, 20967193365578784897600, 4124230136038540817784], [-1663326703072891413887785170, -3784362849042845660141354, -7092762674930681483422, -6646544347301215920028], [-225742227722329916040153652, -4454973393528187582643388, 27135421184504513645526, -10484910046692678158046], [160546367195508334646347788, -4231305765124541026093107, -85289062400847750443046, -2617450337323378400703], [2872530027935368277557577518, 10744202422864805647069898, -2075954146797068024998, -285045252072546377416], [3687795219403808736254423524, -3706200894855575119392828, -15883711723575496370456, -9698173152349769040716], [6076667839365673610319258710, -5545836316930875904583486, 43714050988296805109056, 6334647540642397616518], [404303737942907363282043552, 3854104040643637947807466, 103569394741800565800800, 8989953628749224222], [-892292336642854347832651346, 14239355826686803190994640, -21206554092121385098144, -7063574438229453390384], [1000702002418323877663666564, -15741616492647628121275415, -18900300190934650026312, 2543037496882278107571], [-5851040811031848666359391544, 3516725082430164657388236, 7366449654746032279872, -1305007413313339201500], [3747477658989826463261877936, -2965625369507671024859329, 34420075465243936440472, -4908120837192406147691], [-5559874346046991796727988840, -10927313336481359763846114, -54568109840788561680448, 14238577515392952274586], [-2509506800058224615663459420, -7319724425287403679194576, -34576968832246065511612, -504661830546198391596], [-1438727095623920259217006942, 11107488643314525462810696, 96158056595170071060588, -149881936483644902460], [2353946776450213421921657954, 10225424872060087488443256, 28000324366156976685914, -2741212621331547697726], [380756267382851742042459156, -15430227373349774340811246, 13892329289695312664980, 5387858120776246519626], [-5653271040064687172781901890, -5475455644829157480321347, -53797394591994512985478, -5112751409442798052111], [2707529629250480259052686968, 19647503661466570125946842, 20225418481322299248984, 6003857225400125388966], [5943205612217195299140154666, 4414734489795036255556276, 19231158551544414329480, -12553928499354938584668], [-3906668373227809741391421614, 2153760887124529697375939, 66113622835235792090078, 3906336646757890260455], [-6017265961829074563571116730, -7217695211300267867715762, 44461650340841294793942, 2327770542313826383104], [-8961803737991428784348051554, 1325512854682805283762379, 39701376819844257105934, -2143908667836849903761], [-4795597832290242346123863090, 24123761613357863997463586, -66699133365664442328266, -14988864104067353585508], [-2571814735640492609481163216, -16720035807342956022672484, -64896462437506940142324, -4294422329830020186912], [10622590459232242211843366002, -7042021895640873498150996, 97985266280375351248354, -2265212493207075957530], [-5234232904382803970477199730, 6525376404942588704229842, -42752456268338662660440, -8407118994831528711138], [-14482341993539851179802398988, 7168500953301492440979108, 15529842936897288614508, -8068071077628897176424], [-3045149710219813498080150702, 2197516155301937093531973, -84880197985343591164158, 10019124884870307797841], [5606481313787375073087439790, -14508493501664137322343522, 138417648240659845186416, -1531209011703079973814], [-5596548938156141262192672276, 10584411343118146861789796, -51677389134014355925292, 13837873373737675205632], [14918550895018576901780283154, 917744691831535340152057, 51968461790985576209226, 21744228224078273850165], [-7471875444316569887812796618, 12482507143480427945315590, 45763963550382551691248, 35123522027338991018754], [2912913201629869508934063558, -6498736118992453384452746, -150533067146858503300864, -11368237538115511213726], [16850344857202739820481785648, 10879311135610675112744336, 63736951949857469082322, 115398732691978269570], [-5458922884402611426555305574, 13678207183422120543437666, 65166581037691285303810, -15133808652396456831192], [11505899675917723925389473660, 47441226586602106959929457, -53639114331465690785868, -145803306994682480697], [-450380714617121808407048288, 16507812230977590676613908, -193349593966075176353020, -4624441046416736011584], [17929955144941757216946524290, -1577608384966575238104844, 115018793677957283290784, -3866272812121385790340], [-4696659893098761420124301746, 3641113085195934081433734, -294444633508306858147524, 6543280075364764403022], [5936188970561621518606367648, 34338816096049297956821742, 62284845175137215901900, -24810715341543811713066], [-16827925180267202526240821488, -566123751028188196422744, -236538325777282718188002, -13187428012945346897898], [2831937294332830385871315470, -60136698964894001839288177, 60975978676509183408102, 15274264346652203745555], [17035736594679240558651937578, -4332714187513459449342816, 62562722484464084894826, 20162886443156117999946], [4731127294010119085667585758, 16935991348901282446261140, 46993331926867159690956, -12094097885999387151480], [18380823477123148544640098002, 30137547201089202246364420, -222782340123579706993578, 3609339312872715325026], [-11094678156727472310198259036, -75212313040727057742006084, 67173667233381284028054, 15220172311162476459210], [-11280628081093407355566332888, -63585017249569251803869426, 256202570188658567164244, -8958321923371177520002], [21623864586195873879678344504, 10910190749541742021703766, 119167263271128598109940, -7044325565429001807306], [9174275394491063466585891216, -49239255479984854182858330, -152511281111434509183492, -707750725826602656018], [-25581677094378298500913993802, -34840692163667567114364944, -37581637052706940406812, 24747495147053687553588], [22408834104150825554614014092, 23651181702037813730888221, -189193282617153213195446, 8989760346774916894369], [-21640512054224618745313045082, -55825961405263323079109918, 203559262679439695824352, -54068033151570671182458], [7275944901499597470897160340, -15639531477409787358382428, 266758784797088619591438, 19594446945744497595642], [-7279592118952926772066721002, 22948663251719780329901592, -116109897189981194344152, -29823989051110142774160], [-9694029210957858556826765322, -3296205788993114871678646, 112606835632196860933768, 5664677157571210524262], [22910269132095661067085439440, 33159492763517291876594695, 273648162002562376900616, -28051036259521455099043], [-41990905918530487646820262096, -23849764474508070291037068, -3394825139776409480712, 24258961829356922344788], [26248470206860549675203316754, -49362215692957159856675584, -110228622686441270246814, 15043328688622731130722], [-22628844943264648915317215586, 49979042177520770925896613, 268470137834812176374202, -10463196021946526966295], [17691265639494990896211741902, -9917330568013173944147790, -185194152634027180491222, -12420193719445919866368], [32063442425755638639196156356, -14286471780037959090149488, 382279626344825296476988, 33405845528311848413100], [-37050257953493013399463428696, 18115963699495284809322476, -387922448227878011802872, -47902598991561969377588], [23371315458655742988516513956, -9541563727325873144011515, -168037165341207414624544, -89352324718487617500241], [24792599022101183699312664992, 17118234681482350825980204, 395322556621718166662238, -6046373971183748446494], [7260515012899749962154479786, -27074077383649428899371806, -37139703725597165929758, 36883272977045324207496], [14535986094327403847796949470, -10894856651041729615448126, -139118098944389857705606, 17531117659792571812160], [12556036372554018115646228064, 78600956673378882302039876, 336206692812391599268612, 8812377284623273972944], [-19716073720382683861752824266, -42815769502429461940792728, -283245417307130339274888, 75810259646155814621616], [-418958110618153612175224080, 56952951236584732006600935, 200262070887542814683706, -29330926137136906069521], [-22229760092823625837992414208, 19118546276508319732865920, 110659066517418241260328, 40309625008876594257448], [-20598519912522899997780587204, 54951211122254110879905648, 189736649702390754709972, 14409830792791917613348], [-40222101198193921480856637262, 47078390888520765333618028, 3663064479636089213164, -16470863389538265578960], [-54782238300286394891823325026, -57621681533305695648925045, -152534796638811607627490, 74508543900875285116351], [-15021070844469698651076199514, 71954143558925363897825248, -338419751107859679506944, 7044861503832695370144], [-10034507194689790594678492036, -124352737737482703019513675, -154468333956819290663082, 63822638579973547787637], [-25165980597889027986569357810, 22049113316517732547253871, -145763971968955234233794, 72125741256214116668683], [-19220259351276649884297273634, -165236050760310830297746711, 134224616210410999203546, -62085981291936439240491], [14659674098759145963905690276, 108989404954597732021618620, -24551879934298232359704, -73765245194626394954340], [19429816475658783864841578362, 53093601271880711784239826, -399272650325458272258870, -66647715387555497137344], [24674064660056015901270896856, -109254947554327676956422985, -99793411630388476746056, -62064102958108294866659], [-10433994150895505066376335092, -76422518651070860323850058, -202093828784308821840000, -2962463577308721465822], [28001802592722145791704155978, 102042174775262416857733102, 488549521811274930817142, 55654290222384898861632], [17332651355684065116487026130, -90838008375551527520147449, 6508072501992506842046, 78048309507599885174675], [-14699320319349053517571659280, 59401765701555558794897700, -839517800133002768453478, -81385404373031542152570], [-21490427397941870729376387418, -59490685167334623468984845, -265433469697854167075882, 39419847410652479927215], [54506797963181283184175351142, -160650623884656763823600842, -204411041468550757945538, -79150995441950797448864], [24974957170586655541598082828, -121881827567150774190578212, -591853853365030316818490, 26715308794736743383642], [50839316765191328305142910134, -52553867367570441871813974, 204273419910703653676806, 101765054710409029053444], [-9717273290236962022853500172, -46632299078479480675444460, -744884186283852821491440, -25655655414260968858164], [-15300157250066596364654471142, -159942094071704701590817179, 340482906543779887264290, -146613278963478575772207], [-714785748981996976936279414, -70662762260578278480581244, -253134784083682414525608, -130683988678461568593948], [47731719787719864693780832712, -61662544778428085616292425, 350946665004105511108562, 99200648163237027282551], [-45826099794630410749382692834, -27036147946139254624804674, 1004766452534211722823768, -131480565616450195027182], [54868269176659782760503187324, -115398661204641311921016835, -546905777954908809500584, -126027878106164884834417], [24228425897743484451763256418, -44545176734956034402304800, -1123167530799009251027860, 14199546440052224003084], [-73675128910657127845702689680, 70269627788283536526276052, -1098322479211509715351792, -58672037958955502848884], [77835894562489641586498107802, -108868023405325450438084, -1252134899356842421081672, 61237102348960055923820], [91026125623443928366880936668, 38673601411737745579937632, -222074029523689731135760, 2177162700370614301968], [-72712259697572786127514225208, 125735218077362584121798796, 364499682519262437732604, 13734695499478117657888], [66866080253673113503497997784, 177452449169987740496066448, 727844749440993364622772, -140868793566525421661724], [-65703877964364344819331629434, 74690640725963382327191682, 643457124417183419044662, 23065128376027486380540], [36734939089099277101212752592, -4443162069641934859715218, 342803806151830016019328, 140336928437320166038794], [-6478163487094666799771708028, -116176792861463583041264870, 152976212736286517718164, -26844001075339974429598], [-70211257669512435983744764982, 94534080092154406100395978, -656985016081930392769378, 7287559808500133704188], [-60478215961322854059791909848, 276695350544561237723790443, -61935530601399726149664, -25857987654907286978847], [125086015826681917341883575814, 122965662397806203115604245, -344563661384649680251022, 98404100859190499010289], [-3808975355490475237539082504, 53037455262064182329996556, -421518273253276706232174, -203487200371600754972490], [-75624479680845636311936229514, 208103735517670309350464303, 748944443765314120143102, 143557655399372131947915], [-36645965753677690642220091118, -23894638788055095315595644, -375102666511184582516784, -119126007903505490393508], [7517721728448592202206450280, -229063672195323373964663604, 1424656239183563439916152, -29567882243586105467172], [-51417923013262338162047533248, -86619141019704549547305985, 609507955998452026097002, -176803095815896732959257], [122281918679840055321267101440, 130891466520268241179760350, -275461295577499001159536, 58676528361851015974506], [-93921142930974494370151375958, 6864581587632794550743020, 827034575280484334510718, 234569923602262188831810], [21465791553321076806964182690, -128430565203157651828352800, -715080393332082859101842, -121767030410320457092530], [52871669075516158443116878130, 174765482239503402855857244, -1566159804080923949570764, 50622041723486475182408], [-59313276541755633520781758548, 229175860345313960081870198, 1162577629501993897640548, 51757385047299324823878], [22793456424266249799134155652, -36358334114421712506050447, 558099309870258656086246, -128360460116138950560839], [190289974557736902851809115704, -399878389849948436158719621, -1574466690878595240432368, -71885599574495791276607], [-31701612910176825465906491416, 324111634635630964543463952, 1362259194892073339537592, -140225260071231224895384], [-156654837379894158151052186266, 83620203791572136588777202, -132141687463131777882210, -92298652877000169866124], [-54743499483464216770102566630, 102770860508129830624306496, 315087552904838754096148, 88893383609292831701716], [89322685955914312470213502772, -5989118674639888572565200, -245449162666975510739964, 104320185152883546329748], [144001252212702643792362891752, -89394848190233786479882306, -265973561128234624607436, 219279476489268220658286], [-91473754405275940006441150806, -251946806993917803739145080, -378955833075263061228044, 352827547728172707318156], [71665727547370114861865499458, -92923105759414146924912856, 995096419870539432026310, 228857636910151592380734], [9855466302609843731897691666, 702081605117353254644719707, -427336367189144670397938, -117756752126178171459873], [82348072870463201337017710604, -135858678072709096059535728, -1662527922399442868463972, 50498649171793362091788], [-139255582604940317153999388974, 178467647354478904891623898, 467058805081115038944254, 311845142742543436069260], [-82819956149271118562469083368, -128325258619195539288088041, -1254883548914683303882456, 38900071845001774427309], [60872609115682545353385390698, 279969804335039734515180453, -1523425698414937827779998, 119017109539289554661201], [-167613100246993824946050601092, -42828426055706263484148736, -2234371817892671676877550, 162811930370564024675730], [73576835937882157661815601232, 172789011296603129264464275, -1250650285896785794151838, 131130729067344947232411], [-170030849000427011337429695980, -242619741156621675493214618, -23260598983112987983484, -148302325782259908285386], [17994272509484929781431524658, -769528602951611763248944024, -323184572474056323586678, 96962984254089985765058], [-110220373011803130515005483654, -834712062947302252300146132, 1605463174076205422240322, -160594067375666452663290], [-199648195774202265382861105146, 257369231349022242131050619, 2595590058746334788929102, -96205477637203372268609], [228358322645362774249414404732, -97527297279742327129674548, 656359009382188442638112, 263403065205958353916676], [-21172115549971268947672331566, 56127209254600014184173288, -389373116465933768522940, 271057921390211584577148], [216389058988587584105727201940, 475140512756797719658047925, -874482878212863787436772, 337362317196566239668219], [312123523739134525241136453554, 241823102644605469696478543, 350360912883175272185190, -147222122289036562440813], [-117615956400143675323584796530, -162902212220521438645982454, -575049598817890386601260, 63821528843922678000114], [-200909312135302437557314340988, 458588340836066523441006464, -97436681540876793696056, -290235294564825167427384], [49175003083725776728391928268, 8658953902871910394006358, 1636693639478032117185608, 52070958105667381496138]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_21_a_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_21_18_a_c();".
// 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_21_18_a_c(:prec:=4)
    chi := MakeCharacter_21_a();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 18));
    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_21_18_a_c();".
// 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_21_18_a_c( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_21_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,18,sign)));
    Vf := Kernel([<2,R![32409815040, 10056960, -409944, 18, 1]>],Snew);
    return Vf;
end function;