
// Make newform 16.24.a.b in Magma, downloaded from the LMFDB on 25 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_16_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_16_24_a_b();".
// This may take a long time!  To see verbose output, uncomment the SetVerbose lines below.
// The precision argument determines an initial guess on how many Fourier coefficients to use.
// This guess is increased enough to uniquely determine the newform.
// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_16_24_a_b();".
// This may take a long time!  To see verbose output, uncomment the SetVerbose line below.
// The default sign is -1.  You can change this with the optional parameter "sign".
function ConvertToHeckeField(input: pass_field := false, Kf := [])
    if not pass_field then
        poly := [-36042, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0], [-192, 384]];
    Rf_basisdens := [1, 1];
    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_16_a();"
function MakeCharacter_16_a()
    N := 16;
    order := 1;
    char_gens := [15, 5];
    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_16_a_Hecke(Kf)
    return MakeCharacter_16_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 := 24;
    raw_aps := [[0, 0], [-169740, -3], [36534510, 940], [679592200, -61614], [-428400984132, 2416975], [2188054661030, -79271892], [127014073798770, 1470139464], [-2130300489980, 8576162145], [4072356539504280, -6645877738], [10409216800811670, -425251325380], [-68857008588500192, -925907830200], [-448860632204483890, -10838146125636], [-1147217738584157478, 34950659237200], [875380384309927900, -15008906283273], [-7879872108828390480, 227131222925836], [-70143626700823398210, -85045109125572], [-140436494985670385940, 1940356339776635], [-90226446258251111818, 5179087686487500], [-877116581715778812620, -8226306485688339], [-1527516755097071664312, 10468502603081250], [-4031704126938803074630, 7371208444739688], [-3122458407279819990320, -97563135353608620], [-3437997041209249488060, 153000198229562257], [3197546543086535002410, 19034325199766760], [-15573644423127015250270, -1346057797741427736], [92333101723466467151502, 602314186149518300], [9114293711217124345960, -318983798077192278], [-510685166865416163300, -820097140486729689], [115535273538875128625990, -2350457493049338660], [151369422312248795526930, 2745533583436681408], [-1844577166487603692499840, -6527511400020264864], [-1751774025245478818801292, 12084083516281713725], [1610157495614499797548410, 38799251923767509264], [2109730253202768078100540, -22118861709057839985], [8205179085384012460806750, -97380478136810129300], [4380068370770203333421848, -111699929665222159050], [7600575101844572374332950, 101622010464410518764], [24440418765769116832534420, 22997679659015756517], [-2971203118569319595877720, -202596616602121527814], [28261326142806479644548870, 1040413835156775157388], [-44233123454077397557309020, 744116725230915772905], [-2035658280898116992670658, -681484044766618768500], [-112357119847039559004439872, -2712818538257153766800], [-197490037079648553008809150, 950689239189728753448], [-245018462420068578226901970, -1988275592953227406836], [-160643115850222939628243000, 3926575020695521147650], [104350743631034237039561668, -9500976070298977964175], [-409603468482931532450738720, -13423670783567214330888], [1985616566040633646421832660, 2249160373375951995061], [236722416776370160511033870, -12024052908896424916980], [279673645746964137126966810, 26224636715881821312168], [-1842466766112930030834422160, 10192215904153867676540], [210660620076121336426546322, -22731658699278799539000], [1943621205522509883690872748, -29739728125429574839125], [-4527156622478763698004945150, 7916223567760091352064], [-5984769366959102149896447480, 54450949808810460389842], [3181576436641494176991333030, 34828475286106323621180], [-8552546415403363119688921712, 46254813880553638431300], [3832999153917005177177562590, 125211192075979915903164], [11044850769346173898494158442, 18799566035376139920200], [23873327622550379701063457740, -32513219380892160243693], [9992161180757905622708057550, -302090660969146988368052], [29291729935651263072946737700, 243493096089900692917161], [-17691010296798166743293372232, 255010550765089354459550], [7129605931705965190781773130, -253520556627894008665392], [5437694058332308200640593270, 114564443523150212453564], [-101360778613659063449960658692, -840956455018018372248225], [-16503729773993127204069315790, -2025122077436532172199136], [-129818479465632890039835528180, -216280128177117879064189], [47531416537656996296208171350, -347323017957962610507300], [-171354382654794530272054486110, 2703246216633709112416928], [289979276562354602445300633960, 605987268049835617599210], [155180263719553092859856612080, -4359911245612277578921764], [-93350670389562241561771852930, 2700769137731827420794588], [-467400209673770183965884350420, -2672223184351628439885045], [347567726324766950240087111040, -8835919952944546522353568], [-113122708967079624349643398290, -13071894862783181645387140], [13347138663522603599200584230, 46625264579419846934364], [-47179832445665070832061181198, 5957350580318012683995400], [-161010175868699367306197234710, 9074157180757548610951440], [-2214077843244995324455155939180, 6947403244388324870888645], [569058501391491213874068579662, -15997952420887156033425300], [-2114040030144094742308914282192, 2681721885657282884333100], [-1567001108815958952935983071790, -15329696873775806904899832], [887615178550818534497756106040, -15072143366245158786419010], [1451680403116039187226161006700, -8766025048733146912906373], [-688998591340107105595425148350, -42207054024731919732691800], [1845054114629794594488499912250, 4058101323725695579394064], [4415216712662712095194655748582, 4781388758181283803890300], [4156855910739182315837368893520, 48268898093044278759808692], [862598292484852746940690371780, 27657062203911966637970961], [-2346033042069085773833666476320, -61389519093023684626821320], [-2850680006420374386612899764760, 27315153214517313939997386], [3747867830050829500576290032028, 46686619775478582172516775], [-2518182555413400056108510294300, -209502942438392566189021575], [-11672775949061036109112715516040, 70111346661581801502481422], [-16588051388836043740753628628810, 63173237969254473678375340], [-11926102377689199703847517100038, -146744314085827832107018800], [13472933288004955570254022414780, 284198193643191558137743887], [3278983123215213035300881820822, -82703534296007436648002100], [18533172369460440715412251808020, -112664909897029607622400539], [18838642907713145811434882626950, -71499020059845498148148436], [-26226385854824541578740305935580, -64233570370376170792213783], [-26103636872652636333462168556470, -592599658591664507563247920], [46581683175065983477982191511788, -553239810496260337455850725], [-28654256871646989863213339710, -218723797719330109591491936], [-69385790477119067217682413241860, -168415291279198221276429089], [10625796681543439547952491276850, -222759101434937035631458752], [-80792806304991190743390732258600, -1089664254679602526625767450], [5484119038078698718467224917802, 1087492898146500885793761000], [24355760893393258074572305372000, -109414704535540690440645864], [31456578492914402515373356454030, -165987785018418661454140692], [-88282599591375047627024012867430, 1931978603905476097526089864], [-69082734441861551810676270570980, 2239781137969316741134069095], [222863661369579935972838609263608, -1098623580077278909732050], [-68209372947717122797101358513278, 2836861376255671671517005800], [-92376890304809496185391601013900, 757689501498968054361982077], [97597865066151820788250028451720, 3840187048141672624382427186], [-64697039618142288907934808520410, -289529143049153129252935172], [-55399562514314741202294295318140, -1252202445795227183849541215], [240434708692185544831379934066782, -526307010987569253230301300], [276852387817797873171762153564770, 3536811518170207612153768488], [-138895431402493939023314884773810, 3414799771394944563817786364], [-177192257944383576739094694436260, 6508623116952985425726146007], [390329104678006202733074722206628, 4506190191062729260031550825], [-250918533606972395017966150873098, -10663706769272818104690573300], [-480449680015704270174696370182610, 3148189026998694046787743740], [-584061145364613889525367254664880, -1717191235698494030518935180], [-858273553756407884670170635139240, 5412253112276057950552078086], [-774738436399739824946139246696490, -10604158794037160019648710532], [597957105568452955118931985257940, 12270374038384637431750400565], [164188738696570953470111055277800, -3897350530474533629828158198], [-538825462433747443554853511921552, -12198501514104673448469485700], [-562294914413131536237938984258050, -13714170534730331591478750036], [952922536983440414772191362777482, 13281343069649391986505998800], [1950478006923734615332956869238530, -9935681099595309853050415320], [-380016811131430760746047101670930, -6363337417487952233192412612], [852069138478776692361597937998340, -30484038027413815905393965439], [1944383599306447168298508170331030, -5072090729657093479506791636], [618599666818711266065523606038490, -43730493698224335158134432560], [-2751123174225482469355896113751332, 20485434606175719298185002775], [-1617740150685146112228938324316738, 18924451173869964353612558300], [-2652607721404520693977309574075720, -43509690082670357342595802338], [1564748410633912658113085719124460, 28072488427257073095700214811], [2061535770935793259571158342596470, 57856195184122443392474162220], [-256662718861852504301136722514360, -6790430438977061024296633310], [-4653886868381671688783297054861410, -61164820867508401068282728772], [2149642224832989014177418743236650, 55205740629222368210250672464], [-2303019012851366680931385071217140, 57128653150018483187981634435], [7813242376760823330007854347418720, -35552090805446985399951608808], [3925290318213556892870064329605190, -63086259595186034304642511236], [12884177257037969925188965456180242, 11159928458648357365662535200], [-3049502725202585959374829827317660, 21310897045427363942382379257], [6849703812504206872243362657621240, -5495968244494429583029976914], [-1692030273758107503185781516719300, -64892849756956854476942402289], [15449844671666219685359972684721168, -7635534963195227033394719900], [6169194568406402861131164984772120, -127242811516980733020551323530], [14631556807682464132744663020527970, 36391430127234432179856388520], [-9495643695845857555548045057498790, -91344861436052954576939454936], [18275825283141616146332791515734022, -145169273914086529862092000100], [3217122449816727553891372296826020, 359608974565881269866760105161], [-2123827551453799021023271293901110, 299761208523276377345047498128], [13494272596401588620694869561684680, 93719569062888953844148101186], [-264903549141686917278970542996612, -463393056100177506753949277025], [5679078286484938202676140479565490, -82950773878141676496979121336], [-3453334116774316370556160639233960, 160360908026240200662761334982], [-14364724954765873839890725883754272, 159958466622472593749193502200], [-12166614854581341133412885097264370, 103148562213494204212134007164], [49876278520334023770657721132403090, -194412066184673433383956837560], [-8733729766924085309861054439424770, -551894396573538254558498991092], [26089519883965795813562034595855020, -117746350552222651966236639605], [21957807119768228831173010213614262, -675684165469679876476304100], [7647823476070283747461376957420808, 641455318430655694988432652050], [-10096862611818955337089014204611590, 349677578440666681222729188168], [-23040468887428870911286068674299760, 121765829641738382433020164740], [-69536231113539151289648511531033750, -19822808239714783700372876600], [54649306882308345558150443437049548, 86405750540889812640543330675], [-77643526171125551205036782111680818, 22463031907047033201252889500], [-49430295436253876115643371846059480, -472640619552751217414772718758], [3929685272949009029731582274993030, -1006995533779169525996170698420], [-10227222191663826821331060641754560, -1374331929367813112638534497264], [-150119877600990316667752557178572, 524980497869352136735616013325], [-13120530944867252849678629564032850, 1801060540880627752422690003948], [-96456893067500493832976340695360070, -149355469074923416089590442936], [36919112350414935548159117115633360, 1502427466968795947055470775572], [-70267478793040749788589169378323810, 1290597750120583875004500204140], [152508101320747187553904481602282070, -149413185244564037070664143636], [91826867077695698380788509307133780, 627773229508743561818970436437], [-63101029046428318419146994378512230, -835116572734609450014460525680], [-31463250569916940982127076123565952, -2029348215836551346220457068000], [115629545890179229293511294513442690, -22231258141575946607481058272], [18282333339373380501736420802780220, 4541858951779658512648374381967], [-83663916668205352519338526766015612, 1381757910760078614462490754625], [109488756578460815183785675323307542, 453658695545888500472940146300], [-166447071296171253158450906912689260, 206475739896357342749410869861], [-213796711087774514587695854020976550, 1335408252699670993612028531848], [190834893101915197882648791110869202, 787053444694253457394531118400], [-169584542814827283750413718905141770, -1846147088130000662014965532692], [-130184530049230826749737819225367230, -2490676784270055996027004875136], [-129428239230984995126100862985688120, 1437664547887655333321371101762], [-183708352103806488456995505774056730, 2487666549202817614379505056620], [356198467390458582844777118224886608, -1467259952247816277197301433100], [14606063612963661144508987749946910, 6092490780999277038826621847964], [-150269400024282961326159022471568350, 1323070612120334947433405529600], [81079747037662239199431759790408860, 7827598118566040551937200161735], [525026378972475762354724527648510390, -2489991434704036076036016705636], [-724575249142489984232057232992510720, -4091148273216240097136217904320], [133261831701045869771750368122711540, -10972944216255793751892700426243], [32630407619378123242189897570358010, 7383934133371896451137100822760], [194840040709931948074690298834724028, 3772024564523626333976583999375], [436670629995044323787800039747126130, -7008960947409150280836119111736], [-313757580818926214580614196805681698, 3375342784080047974608133329100], [-9376142987007697135995756057332840, -898694880817198852986016950378], [777705083893864802333398916381028300, -179733592393159378114696790189], [47656778531329216912024156440462120, 8081873142868595407033352463770], [-304102601026038157271490620157094438, 363416769061528576737176370000], [311962670093146414569517050642397360, 3552401048707197070866453825036], [153591216327595966208107050978840882, 9114876983487054987129224520200], [-351945854310135119965012445397946920, 8013471196950773266090550136486], [-245325041410959151830013608472476330, -4621962874448983435039796651012], [-751139261831323825229247228186847858, -11171222384396919038388288587700], [-497569629629819153841398067356174600, -17207286773197140020781105512850], [-65551007327453558625783150236784510, 19089359012369580595893649339240], [-451331446423681583630691604468609520, 40687128375745145831792611791012], [1939933225151106434440235351813987460, 15985639738549503215888454631361], [-410859463584087199251409023939348130, 12220114690353275816501993158620], [1920144484839359113030399710914309610, -22141003650867430733592123918232], [-179939838186408748486090085390648160, -46349320391485142516389808401560], [3129057717343400094713490024426026920, 8330829229731282161625012187386], [1666374389321819117516556706609075548, -15411905008613483612371572682025], [-528862684357908474635610142878870010, -12492634601433806136165263427972], [-3289825473396992860629521179611963740, 4810983400807270438696999790985], [-728972265627507329216022229807003712, -30493119046659268043678882950800], [1550120971170139205799590818996803642, -32364214549788562871541491401400], [-2405737955114309881410033353683286660, 20031811293897890550798546891807], [3676434798483133020565792111249269840, -14764388534926911376712168773964], [-1715977246662076016000138409143456590, 17783258411267381086258318365960], [1581030333923136917988505210542424350, 30030985033858262075944797313548], [-2540251906407850798877730716660080500, 1869095312536353724576829607875], [1641562280996100744805667235933153768, 52566926969762519032021272741450], [-1317399724160851490595099980501749020, -11243648004756563094479844365063], [-2097833901268372655939008114336011092, 19330887422874990014377897488075], [-1082616030234716462734738705515927800, -92300108467585329264164009049198], [-7393093582261253452668901049061967450, 951959306535373908531585881100], [-2844304930581716620629593623197671310, 6039805786038697137821960026528], [-6497585868977320645509696965837652840, -48971279165011296877736683154090], [875077069793100066501492348579899680, -51021769929023429847684687102264], [-4946954804990825118864380371742604012, -13065840208370817772631799331675], [-3629881383618810502833007262215146020, 61261378511981491359443708374455], [1452100243726458334115788094016197040, 39026992067463479756182254707532], [-443727081431290612558473345082892170, -34776126200437862841183041308836], [1848443861458047952795864782821156802, 161102583249007622617388636340000], [261762062825686317433665505949161800, 15405148489074959652992023255586], [2538408484275501987916994173536629690, -59550233974602824869344402750360], [-4145875764472267243355212535326870170, 69247264297366710646962857932508], [2654347247907930586326774035386423620, -98588481309738538593194889582255], [7945359592806602425163496694186696862, -19529243140272597765292885650900], [10300940693832757744283249163853474060, -51733392335919629911431148651389], [12658910286611850417304622930508013710, 21208866238099429366086447563964], [10655146357407961870064895163035159050, 34188186881168076003726221579664], [-5387293058888890221297099301731102080, -28977687037233397878664375840608], [729674526023407632056675703877252980, -22842415990512900570454718359139], [1782547774217991625891412937526494830, 80519749728949411059092250767580], [-7470304467936325466975143354138575850, -7991648909260237865536665834852], [-2203919240152168786382447635250989470, -137544502724208200099168962541336], [9174374976712060840366057627754986900, 36284212664212067299103765365125], [-19016729574763770693353918336935785210, 123180432758072597112134204069340], [-1699978296033461800469035818522422838, 251250845514363021049073123330600], [-6904311500258114935724884273070889620, -145128779236290478105556092304613], [-1866459556490515814129463092587419090, -122656406904754529034119709384932], [-2299674735532419590567940548970743578, -319840432112819414499187014422100], [7891661442386574544464791476604193220, -222170838912019274457391306686639], [6342952046505560552831616123030597290, -230827020576362423036121003807672], [-7344099137970128441551430377446878240, -181058722881951933454173398852040], [13587148150434040923769868257515500690, 216091902765436675515375583292064], [20133701183697195379923939699853726840, 312559355081429651196090976197582], [22471467361565589728882670982777204140, -44356953604143791978540285279989], [2844483893390522257457790976379229110, 344077516371838389946390013775660], [4370920984135339716616236455493886202, -576652374605138070612567058219800], [-8251468695543337633572139562237671932, -176217959018003805856741201073375], [-39159135274246941216491390779107671520, -33345683084028451326929725159288], [30453719057856713395972973474877965608, 154750247391296615808085131749850], [6028810294584135381879480132760526520, -316479058163470888240491722404514], [-38439226945947800534987542428323867218, -277052130442327678178936543327700], [-21530101153206545413173083839241410820, 170109832803166999834190138216511], [-33617303058199509285028045420291966512, -169365584801723530994637301862700], [-18908399074932474877567708676249882830, 241077785958887777849980178476488], [26560583248766596492669171040881599390, 92999934585654132617000767309564], [16492381082592376833660934076707819480, 336319796050254915664910873987430], [9820225377615592252816748705366869410, -1072829013256764596735952779247840], [5458726760373600200520038011370335302, 317625106018684982682192996035900], [31485160424073418435926994674763289700, 465282362967577372128730576427961], [7697076084143899867462552584344241930, 96230524475606996269108022084008], [51759828638562054272484921421330069308, -492236139033214922509678610211025], [71980808327548264201369693025540047910, -574355400703722485971376282918532], [15394936258211351774768759284648003350, 784554523302349055972080461383500], [26273853888477881579712264970250239648, 571470525807755476046030216073000], [-42377087660285971879814848822019816130, 1074123034511112721695882444298988], [65402067622518138964394758930887900780, 214289707804001364249084447488955], [-22599283695768654716847236215213091660, -942412299237591264388730113140339], [-58058693770724448482012337971693201350, -298233877477165238935630769512752], [121646089116485194484568257843815725030, 168532085606020714826365861630764], [-39217358420680364507561429735896660400, 548677039892763817990786638726900], [74307554201061936609128566840434635460, 1079416631082508815728019876701297], [-28700510989284648184591234655398722932, 1557923242237094246633379166702275], [22679996921434316941611436988912263970, 241790607633523960063285162116264], [128107451388974397376355470805166069660, -368579685645733764354000457423289], [-52953185636205906842827695391683305530, 886797521843232784604085700127820], [-50625631549256559147127638121766695560, -1902244551855782743327241532076210], [-79876419779575239986327557527728565010, 1409878422118611980708459129943228], [-114224539270080394724630751256512512880, 587224805903255252297193090117892], [-10522444756190288851348920934374446370, -1677349284161067762863939988196020], [161857983413670019295100546034759510242, 806192021695618503097210737573800], [96589772571632351634688290855989937940, -373270303251191347632235550385243], [-97195213369110107270929185113628582360, 2026129280836725341140379760477786], [-138086181485942236513916093130943991590, 995092169574972325294474095326760], [120581924944544069343005654733404254500, -1073783269788669957562036361293175], [-62893638462763891859297138382803216832, 2710152162270519017487125972666000], [130970695691264786698750801387193339330, 902152721054841261873265082539008], [220653004008370546377331329719439569970, 724969172377169767613845291405120], [-97342914629035071895290566252276143292, 1307390351289536358867725523342225], [-105456394633813630077131367380315083990, -2209705501247805812568984299580336], [79269831256877573974268921024330062422, -3618094125016492777670835253332900], [337693744625467262343202221074523138400, -288762050220110034181002007711848], [89297155906340578509510294406574068890, 2012996943477206907605492370680528], [67750942466689592204806521414750712082, 1395235600293738636596617211435400], [-82422939790585296717486186725675681420, 2150104689757478911772711999291805], [-225583483115028015881782211191457500340, -654337389810421706813746467679053], [-156306485723895301209755423566953621600, 5079152664181074941580127930466536], [-103034261904141228225827452273533147570, 5263504303197940086273169785948108], [-261706290420730234451942300078548082938, -1114355925427904571314510867625300], [-66913526835692007146268404792448596490, 3303077431403363764368295204842364], [56369051484737747235675995781372072640, -961231258220816177806977813191760], [-62779430153471337291245363624666868300, 2521671481266656795395769365755277], [-211284523355398754298757791994776139652, 1704253049242475551474123394279775], [-310599393506835381981119098255012885620, -3513812200712668211207397301792989], [184243450520679199981833730469165199830, -41224714391139585884520747319620], [-31388716135033251146357095407469041630, -3590173921768568132824782791426912], [223162366318438261183880982996267542042, 608471975011739100232234357182600], [10645776495444038685276439049405449840, -7565419685124341647938322076010564], [400529811939047398549245686887182026750, 4121955056489514481810238595524748], [-310327805651107141905997752945505866870, -1639703041479528312742437769746736], [150277152494178145267115865217724740590, -8595364527239815339406073548582660], [670835454745345056883012723412288668168, 1964548870861401348646436634445650], [-391163920030676888074500915302453840490, 949246863867351666126990825030668], [828786492896917548095559712337408696340, -1008808806566143160002056000976635], [124916180930784605219316245278709212622, -7386751575681714696048212048620500], [165287633996870842325444198507743027420, 6212772981761957664043532155362711], [-490417552807419244662704383419715478352, -7526419654236369922910923470835700], [-340535380975633094769007569077397034050, 661232448342220973869493290813164], [-162206779529841929595333070277686577612, -659974688181327631141579713167475], [-66293397077892233142214148579991440710, -6057366879113555979420384552348336], [-793228611103407337987775721046144719258, -418994220358261264572852676553300], [-415516059344075401409870108856024998960, 7425343162076058167869044060934932], [366219247677931526339117388182457015710, 4530569059307209848745651200634860], [732368689007397232781429034769662763050, -762298527837057439019053694567352], [-649497209183941814265298231682986384800, -814234122729461888203137520719400], [462464188458790491715880731577778909468, 7301545877974365170453051112959175], [-1029380164128144531535588908036265986030, -434277757130781081061666681658936], [-1352457964676206262074707505654812128520, -2781298769429990114191014494390738], [-556556730397677073088778668505136569490, -5430789053592356160366532653499236], [125246116355456286297908509096612364922, 5277121289118571062540089406881000], [-924756961779355088632204353665016618480, 9134953008672514405510609413576036], [855680989283057925015857521255738563660, -8100163674505203891686466837293165], [-1699561726428386451401700426329737095020, 1033638105203578950602804102124261], [-392519004160591589231868533552460709030, -18437019431770124551471595653733112], [-458736310161750028326503259883268092410, 2690533088251425790964876120483564], [513878424814819626996454496651913820360, -19951765892434191356991006786260478], [1303400253703441862443059801655285953962, 4426028039238879301630533545173200], [1703231740983208264834196486508662097108, 590131941779796558016751023943125], [-55003976501332290028246740243600156260, 21717411517330008939092496394428615], [457037466588503904320639068642268626800, -8916787675433634503404073864540548], [2181154724599379639079794732232023620350, -9402094536438951200722685160393700], [-287954691845557161649525286532253167752, -10958467844495509580446896405409650], [63803308233955526289500957449290298550, 16558075675319663162492226513467964], [-94434008956747792511453258187063725820, -18318151548655742727814098011842495], [-1378004383766338937599036772081296143072, -7041140486452090637932543492159800], [-1780081717272108416925415298755024126750, 17043344045843197673768865389854848], [-79022755175173082507491038398773096110, 16380114417950879313036348226978440], [-215269714205142125455496079564122287030, -17932894991981841428133535818535536], [-2172803586989412783312471518920661625738, -20810225750592417417936519034735300], [-105821737160248565775384942942732408390, 33541731554265764888787493155265168], [182078824878992860392207359040212437720, 17635804653250709293898449153339686], [-980412025670149542618586950735131008350, 2785554552577268560044094810408064], [1311454037642865606971163367941854623060, 35823424459417386701841265540424085], [1344549306554287519476309693969265148520, 34470112271783660513149959397872042], [2459326774086361914545712515144552827888, -18744214292192203201540587703126500], [98133687381415532975429736127336446590, 169309840436870204312417374235964], [-3486266017212798575032106604721232168660, 14275808119695124760874845692880907], [800693699059282381590264591637976192640, -59970194054144242165533820317789664], [-402869565260745740354878781092432766590, -61952836884198544331595768332377440], [2316058801083402299495484220689287395950, 16804284101893431435223848680732348], [1185000852185158823746592298515413731900, -138209742235486539348340906796625], [236039553935956460917662494830167079300, 33704189644946231038528215217273761], [-737737511008362198718884801245947251432, 12751902983971148245837122785874550], [-1085813977860940245547744017606311662870, 59213613468796554377005123269867408], [-1387379095155027305987994513950130742880, -47866567932306696307503437762350680], [731788681989087907528819865403588295770, -18981269986403111317272956163408880], [-398956520600542731995747887087614006692, -67606221717446588801664840233872425], [3435687403814148257514979354315209449022, 2712126579574515000499916996038300], [-400496378749149150478722400352415728650, -14862945115149084168686388573128100], [1925728568851847484563890613825029972290, -52291400903467151399375578544595672], [-727008616810757630859557646430886444720, 45433411433439590822862127813189236], [313029116919842656990088383671354526890, -28717841877065434374645686906449136], [-1673267515796108707221554727084453576690, 38292010362623874427598035302044460], [2055709336031104218151584989850870007528, 25849787602069545942251743218578250], [-2487523766927069268348161215054043757370, 12325700678222350533083780291014764], [1353128113755890527475250506966867155602, 65403749647401714585955739374353800], [-2822131082319433967501392666392517875740, 45227539417968730124053204775907897], [1185984165417033502330035490255759813620, -38044049435062682796512635370200355], [-1592114496150127943082293858754880539790, -42994809189890904180164198557576032], [-6296025933663317550591540234897056531490, -21287581807862883084901926669126436], [597255824413865824260026219973578378700, -57035922568984142943884875546996173], [-1623179380111469476843720257063867715052, 56740684471590689190533871023725125], [3306994119292128056473393295362003967450, 10049442999451685103503103689702664], [-5035330446645382839267934975039884465018, -13418271482169322195966172863746900], [-6076199535971328556861265486512034569920, -23315656774335643635727020376879920], [-5449203421376221846277805949396641208760, 87721893212216113019776030288271586], [2519746575575739466805054495404733274930, 103006522830571945406606830535846664], [-9435795216593156754383886847784172723240, -21728001594989352653599767942729178], [7330381593223198075138747016474909557590, -39841097116582045088288291247935860], [6326847868180529256502398392246286685070, -64487507728603809790383825481200036], [7075852099132075900084577705350277637360, 45523798279876158553417256836703836], [-16457463679328694295288651580907451860, 111920831778044243404247995254789515], [2750178623314973278186252030758470343290, 154638333658646865812491376563243728], [-9742648311151830836248282683879404223450, -73812998206336402670731747285173236], [-2775844592757250006891668578192244198780, -32258593784529289459455033719280383], [-2510761355488682835492349228120733493270, -86722941616662617648017172939104920], [1233601778620820895162043271292146099788, -109498462205168564353017122623166925], [-2894334467697909903017618611812647065800, 125265918299131643001215565102015550]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_16_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_16_24_a_b();".
// This may take a long time!  To see verbose output, uncomment the SetVerbose lines below.
// The precision argument determines an initial guess on how many Fourier coefficients to use.
// This guess is increased enough to uniquely determine the newform.
function MakeNewformModFrm_16_24_a_b(:prec:=2)
    chi := MakeCharacter_16_a();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 24));
    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_16_24_a_b();".
// This may take a long time!  To see verbose output, uncomment the SetVerbose line below.
// The default sign is -1.  You can change this with the optional parameter "sign".
function MakeNewformModSym_16_24_a_b( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_16_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,24,sign)));
    Vf := Kernel([<3,R![-19020146544, 339480, 1]>],Snew);
    return Vf;
end function;