
// Make newform 16.42.a.a in Magma, downloaded from the LMFDB on 23 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_42_a_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_16_42_a_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
        Kf := Rationals();
    end if;
    return [Kf!elt[1] : elt in input];
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 := 42;
    raw_aps := [[0], [-5043516516], [-48504195130650], [119392445696650168], [-3153808852281809358252], [-11410299686425943429074], [-26723760622401267203746158], [-67975218671585815673353460], [13505073711965391061204062504], [136715473782261984486517330110], [-3061422960031285210493644903712], [-221949310451710778755633026909178], [-501985001900072034529449934630038], [3118478207799237814439067265458484], [-13155518377394721101101992302953392], [-323998598696161709213951685217879914], [-3459574233993702447512816107676048220], [-978043389864200648530692366749996578], [-16627547762843789524411885842685183652], [-116968857862178710569082285660379434632], [190708537939407193015711554853622755466], [561362454250092673715323867778422642480], [605770926784301808468900622973886535884], [11915426835300121180468989518247227755290], [-63576010574535484047856854187104758743198], [6209870560863188511855630172901175844422], [-173412308785742524089103102162200434678696], [-177847433660272904624909715426897661190412], [-1027368167065303051149114840122320903853170], [1360758254489687447952462592309696108152306], [12570076233104936101873704650956460396276608], [11499737546541636409717941682828750396286748], [-19912022156332934513543804148527258873074998], [-85743579476274966472453389625443139743699500], [28550870321029638346696576186340191490575350], [-189816016146448549552140432741832343341982552], [384758169711821099551628050485036430489662782], [475005594633603929377707223899901409543187964], [4323452970930976947812155303871000429301901848], [14492424890701607349912673383555378573431922126], [-5676686489228542394462945029568908154947338900], [-22089529317841423587996101960491895673748079338], [62339529346959540516259383371291637669812298048], [106447616752532276188354028743337617564675456706], [84929575727690505900076894428517412703286067622], [182716141257067664485926829367987022122927209720], [787225572486249858702645233299072583161133478988], [1321596721747418235973399371450961884561640819744], [1434557387582099351278051888044790625536725441468], [-3689225344799079435593704775136478104185098935610], [6325614066038401062189777832328880235682935325226], [-8393853877048816827611112145782372231038265901680], [2761681183084624759837514857742159990817877949042], [-5475055185715595307214516201243254613890989556252], [-24140275651277531728956439990189369348657396831998], [10076720984756832842794720934252206053085579788984], [-34758011564092397806730976980511571651187985139410], [-92021929212468701409139644541388272964266038011792], [-112019129125196131947663785484913532414641670598538], [113941091180964391156503342900855706679920803576282], [-206091256894473803642270799416246190626671625659196], [-336281053573324192647851612154812513721258885446394], [652252445985124528186623539300939484329090613942508], [773007434499275923644739564147602580817396374547208], [2768769928698185563491069834117561109469392539076346], [705058169012170415521550205529531193432961011643102], [2051366498739809134036829050439149626655453590103828], [-10372473489430296706605112922726780998363790202926638], [-285107480482638588286920853214617323279931610187132], [-9316732428077037228903797301985086219325281174361090], [-18172071574557844088435154529355217704579186177472414], [-19079131741305111662546169433876673473560304982787240], [21175960501572018467122754611940654254660208298715408], [-26456562240646455310112229110775591229601443165944874], [62838796564766649415622918011943520577466642646186340], [79622129477200989528904507772039461537128118042641024], [-109704885343643911621847189834306272965894565313943450], [348160898301227745757281186708202291818500887360740782], [27818025021473470114530545323551865400936235829515282], [43454050314980769058590865127601731946130650320883290], [548344128201555715530724086296298957146668753348666620], [335909206169911944658789281350973928663445375506860422], [752112940461997822430045571289147075529025075444661968], [1011712695291593121431015693106074401479542613433579826], [-1177953519188392011211796112417036894485685958882822520], [-572043207136915434977177728541724960855261816787429596], [-2892698879467099227201296981446991046275934608242382910], [-335307047147176648142594366716944013899949213872378358], [694063809824488935398985758325243359857069510556897262], [864109199602950483060710852518979833489962244930312624], [5758659874416847925173906164161562916402844503227951948], [-10624129217239114180624341523356197241352964512363027680], [-2537314661743659199683015402630197566730756784981375272], [-17401257154325921893958578381035822507485511202264018572], [-1715323100366988265421667748269762399622377307328986580], [31629073560930432122638787806198487157890352768496131144], [35911570648780706637826396322878840273399262546538817950], [10353350005147116813080920638108924204477188478648322122], [-1167960802092566732578819818166639106761173405675806636], [-127601379811206900930904314224912524555698644995863960898], [-190287487027217850595444651067868575024968129225193127812], [15247343284851037497593073555257395461751900469288012622], [89983233635180211453199070266462201043149997787361562604], [381739835097165351193917479526822821588455253746880065530], [286684142964083157226200516626877250998390752828987953828], [-26623793891095157072930428954820298699330038446175478718], [-789073085293503822293268306699758532182518498736255754732], [206394172915878252057121574325846976899109350389531521746], [-276253524523976468281232333117027995731257618813043530520], [-831600161296620424818582327206370923636275922514520253158], [229755158259506719121927657533157459499738589940866764448], [-2250258156147730571361329997047708515892831247005653028794], [-386090046534193780155932661722365151204284725966527045718], [-1662997879548283682582762391000335426112173510188359742220], [1113224865620809123830482912571908574600916849396141369288], [-4230056610755595484349920345088316665661030362071627544958], [3654157014609104429737071208684356551597294085930593408284], [8110398205425932789848159166114144519213861110165888951608], [1523560551640510951486513052212112770366496641724421760686], [-4798029887281516937926436962867649802875283735419362257780], [-723138260011012367885283194723036170388786890912415605258], [4084435161836125296298305914286277220826678448504108293026], [-5759682117423034322405036531356991753418530099117001108858], [427246180869525221036972272248870628104847976475732724404], [-21561452167455680327361689344419178364534526942686993388692], [-13458274286153045225664739803914385388222189117382274506658], [-44989257064125664829763946217491656024544416573752621378650], [36026415150982244744829088570976164804387189265392664572080], [12107213027413865910513478148690027434939589944918688067688], [-45607050762635466540112996884064300426889403908405401757314], [-59899687304386794497493204407342800645698818357022311265860], [16079952442294633774466655450929441579120800652882531229144], [129410199216566756904674518790891437961403665458372598819728], [104679289549862544866455176052287270194433684590324896502102], [-52202308778899190798286966407101820402276558970689989353798], [-114958155623623589257734044674620384760649674592758398657790], [216390185796271373664384726910174076936571307428670642468326], [-326265488274930718933952777338965601057373139572037651697652], [-537863743149918688301026336180647963044357737898311112758338], [-70442528987479658236572779512014030577491522593251711545750], [-675288743630278580511782062789032163060247990186056494856652], [104794765107732393423744532479761242802957031499425146180502], [-2141071808824343856164853721672343026347353232956300011256], [32829546716909040443180558181126890833696203224310561098148], [-720494960099168138694963733366865288008105776828514350840610], [237195705680509229122150992877222453927969685438763457574520], [103257876189469901316932621609096097185955813460349964739766], [1280575589566664036269155556547992898280042224418973353780762], [1160673560734201442139860465095837983255456768201487328585860], [1198967936436788747224798313869870832014066195359369519244704], [-1626180285919007604595299026616367660000507312060695084792178], [520975010511479913142779182769406282993634557418964174192882], [1273766882807047179564321364816441643619548297148533233063084], [1402710507816747167798796058464056929089565761355408951295688], [-1323235433753559157327566525221007018071864565359778292493612], [4519727020356695598051591218875199076443934440947137346875888], [3081440647762455313309967006412687847087728236316541644005800], [-3193200311716018921131803975938228095320653718360355618143070], [-1074267705087330278409574389017713154142685903754856428150038], [-14784118473155228654644985854427924039175553725249909486454578], [8720667421231972162598709867020583282453465128617794364285548], [602037285895275700435173854383834326414736134981023734730106], [-18573042641072701798297187574647557869627534046185196795559432], [28010139013042944658276817995322281678360686376817143076065428], [2947131348402834484380079021116125209322329896918291454791762], [-11171817215038535230804600984512719420462240498407724265601176], [9786820333310034575086317451402180929513287958088468955730208], [-16223049070470311801252287033205215455447676569381522748162618], [25457107018833882923212230660791384249127308424366273335096690], [-45454157036972473384422304591122161545948791793939032501347754], [-650336794060576185673163643010490123277449694291969963990300], [-44166951266534384560329320070105476720556328120077012183925858], [-115242048578369017444513035526888209128548974033478843899279432], [112846129395781473405487616483702601759918336879378043650243146], [131349902495383400445598706180303940372020079188751870754676080], [87490626478279088118194632073108839674394188691844231223227610], [114566483958444035027682019311254251919694608375969636034707908], [-7443686114621270802771035706842187702694318812438220781297658], [-220274950760722421631563847443974067424351566232178362858669416], [-29221938609877923954828712216189303586475443168390658077778610], [-290419496157126010024030025228781344724458851144991244108901952], [-141445749822378482590089233972360312415815834163474078450969252], [98334405280890734090958327191516471438493841437269162859979046], [-320957320628790970825916627957759248684568602408607757640805238], [-248470145270982397076181567554733585731335749004497016030235856], [-348799943614158950785769303960298872333211549475613093788996170], [179794077625262079227642197205137589873782759745314480712222462], [36825091719675314384730399595519400534976514459595465594297404], [-419780613307345440678706746324546331804871051128730823567732310], [678255780779219095674865931873892083757031253250340585512421248], [-242795743381629610016729387586815121576642932200193069690046334], [-832791708833357535936054970764251676717498644453255078059505196], [-226003352059211260025119482202761012529621737388998096593730932], [-1439375198802217886847097455304145336555971021997725738814170818], [-306921539227767362824487171256294434891266433003277996897678852], [242411400100842373418994770345335836278421550435726769571417066], [114951494629164267773678693708096284121971948270229862121608242], [409464514785174180193896865308666463123691973892668992453489246], [1061940447113979459651741940432418584566179640765048011174445762], [-2967593287259083981605391805631139222306649311522457220644562696], [2075814717395271027116971628009088638193037956769118245313342190], [991794409615294209491867324272246708090941552534359463945477808], [1471981928157413726174669085706377999522869110289830374630322742], [-2100792272519290027105705764208106930599613867651730610436270110], [-5215766614162205016995170199832031767170656315203710012920695180], [-4139203709395848290898822848443270316921048268336545455383673698], [672922751155910440005921672618525437562914298241386956976567040], [5537350207638002742522816492193466815904034359596875869072629404], [3513098809960836339732732264661159880387981268082632875129234250], [7629498638360657781617995454689529638466209198444957660675704148], [-8051024878910108096201672035080262943889059914240887807505292398], [8566995430093447477187880633422851986430809965672010581237740662], [13333592539630467503578103708737104431432320255252901882625967144], [-8430001819857418818940429677399377041746597831644601084253800252], [12094268062110342740075798320144122906008468506866362740705923480], [46887442819669137428246051266671612313505194596702159170461802], [-5999647421683798873866078484194608038296288568297579614269116592], [-9882220696042929209720394731352036316846546819620773361945047598], [5126810008784151249204019862307247522458870276805674438782740968], [27784643067657099379939005768022879243043331630712737392290009086], [-13745474901217081482873447516206458774109051610102848527943283898], [-50055006970843073864909697041744281236624312865862834683836666680], [-36919364856251137670120326775627331880133454419309020152465636990], [-58222553193738222208671413550232801378398502425535447231415787536], [44845727618657830289425192606800284417373267422418701959005960588], [29763733274383632613416992230610985147870546724346888933462964470], [-63901666359224972621648383140953195519033994933793792025506573734], [-26460438978849592285042101674086588857939437971876299225363576480], [37030741919555930789076107668141118668502160700045354746103078168], [-21159342936053493438584681768684184282092466387663418238377742412], [-36613093880244657487425041224155260198725034273283600885047293234], [98166749803220359377635335116159908987705033237199656552688259180], [-10911951503482562879968672584911334233014192096298018244720454592], [128270169418731436411408855159029541005982770852782068784353997322], [-80498177536137181541570806004635896880943408624828143577377964396], [-156256670929689196156827785470786848729407126992448564811948493392], [-76433444303961438695409499625290646502328838981865493625720479150], [200994223078328040140902441800613680864628345807211898432014629686], [234653073434893987229642848093067433886234904017893975365634085380], [106137717635484449873364982449135865125309680193996690460728156888], [81418201594396663261687391674445379556810700183891389419174960684], [-254689010632773297358627803876672187783984658292410274165752606492], [-152446078234451100892944234293513015022862623613472270090721380936], [225570987895716192217264481241906414824480845153773830878687389230], [75543792065134890861372009194390585999555380666945975290053586066], [-128781228138273642279513880872194560695434912622978755575814268120], [225046244080688496102867763177870072028933490930601121297741640928], [-120078874119056475910344755200019187465424754615704296167753491332], [616504228335619244527657455025183684940815356207297853626421586740], [182092058954171219873094871072239244768590057619648772216454628944], [-408490949327019811116070706076959477069583003755892695804454150178], [706866263157268347471657003040660976767701947526359117941028929602], [793096743059496306378626872614415401707320274102698923338526505848], [578415327314607804333938613441275072917185263000708156785108854410], [332787790171023431555559513531963686102505419574970108143260686446], [-803265206874310432343907889372932092426672770637058816227031227700], [-196087940984105700280172593424748200922430590138336167758419083338], [-583996120843715779358878452737692812695420344568552477882601108092], [476752435342998479085871453533470663622568582081625871367014290502], [591228430682659278362366106431836472413345382821700868854265286202], [1730122775180063110975209522245672293946931180232036928482920002944], [738203626732650433446998071794513418336869241411035861161825480988], [1218905783036837254040094886664191694041037457722986596461385782630], [-1503951287522124072621176523381209364055371443395602544856414704834], [605204794101184954585712453844502630863073290678895245872354738082], [-1691483888167798022084164516716340941478335126696995099912075954180], [2606367227800812610350787089009990869225651204843400825650687267790], [160166009641362771052915406662073818022353817590341048271096637562], [-2898247270017401744856169696145232480680059846206168793697366185436], [-2564425119097999489507770826395902058688325169160358929049873025114], [-4116281360333239373610983108189600270738273135444731038844128920338], [-2395428889450042887225180953667548649341449461294247873947008106932], [676583895390645268886944842921103017709275161542023161975584552346], [-319974915813201178222461692897598637149080281548068584555768801760], [2083830241243449197107412052993237645068992730691619258731279945842], [-4441211541540241509849463384316817329582329925965268260700209918136], [2976447183198691038443813990682577519925313054374032533422156302308], [-2374156239498107236258013889575411619609766049284928606869078092130], [2346529392018260281677135906474140385408070569736474133205014132042], [3400778462514198177601150920762272712308977533882173946637043813388], [-1610148322337379999017382988074714523056676686063096771226982954016], [-14502872771959775841587732361555105841688573467542192326823282720872], [9338998774566407517616803942197645094070332193924918603394313237768], [-6289402608612348636755657966802988596047647002359162146470102107098], [19779544548386625183067581616007431224197170708139739200334222979348], [-7662737806522527929512888074447419569036946871300589863395960555472], [-4567727152884010182413725219937403822448676759436151931017436602414], [-5039231586805209526545634476378418333967493362159878921366571939658], [20259434262696599294731936126533475296100942609524236413430657849320], [21253172435385098355714147403401329095129341435383619310958907162210], [12700875599717344305778010246379274204561709861130982762211507448462], [9000620451838012593125415885199119514585759848140624316078712058028], [-31735062969360656835894631412233922415648323905740650616791275432134], [27674530267561877210021597706571644285951327976793699632268583333588], [34302519979942726463914209055097412839601364649961774842700437050286], [-38083831447753106585271828332392445672038738046929071429201285204930], [-22415721093772752258832621425904162690888953974103806854149086267552], [16113277336140087953884171432695665730949209985088958914562205973526], [-15691526542009753395541200892435908739534021994111018043311606996700], [17990599882646891873887050458225040396987377172091963073899613361628], [-18454123936454633145367663940258146246036307296598036829366559038454], [17508134163804654943245106504305357616083846715603176804690580784622], [-53126229064071080100919547881277598726387360106476879556326844554320], [30702193657123032034669029204289472466586479719166684184062656361804], [-2192747628097161561999915187909769774059882007156406059530448879612], [46781689431596826076531811642220443477634675218183094449812998877922], [56638536225111784828258559374679758073738279082786868262251859729268], [29454753418916542452176890461094916757736165438171641159030909325070], [-47646890588924771634081521938663030029139097698131548494050922731960], [-20516402131104476916896656408168145835793669604758498579901094894874], [44100796402361576491917762381425513977589221813617777870292412348784], [131105924680362411961589177620367882976944568844262242090045363703670], [-11056083895600951643058613729491421063677501061111240829288006386398], [-46354507882839394360019363362323768113878454925204965561611864388996], [-63648869043618104757398936898459024347787042747433407060090572286312], [-64488617368513180939676398762509238045205738048174710096187945436310], [-27677643132332807280418824689901891141926288333774991598165382817300], [158942652687949592580461649342939815408754450896997058145166958669248], [-91254566214112921707438445366813348117338069947391212651690107563454], [-312515623610976350450321885034756298747971748920059891663834148525870], [-221816231653145279852714017703184484288007048182693093337845116317492], [-111490246005023531500168895973951392178093076290909910001172761627878], [259241234406145235572017417335751458766760776667145721171921605421822], [-56233657413526342269935349808871814719309796344848440875843043895136], [171838251704519758402513145983903855358067557605987634682173665490346], [264237457432642770896760809036956017466372713786126721908553084366322], [84606857924861752512879683112169487785071519451154521731334569238300], [493084015711140820584433455155757836216195225474495216924653056072004], [-167813391157079200017585472151184581577951055738272539617890993074592], [-45225688756705441812232990632655301696797359909917910295127031707514], [702554662484066688272224404739469343751422929808220464644220960220622], [-168331520078019514725866790945396463868432694217202368448551341517218], [904011999591226069372102529343301140144371333853840063836541815920960], [-396149356362000833962950004826170066086974209140136367632278786650916], [962753839415481748193858067408452448282044084386297153038625448682388], [-17600713137358570662221938112439843890330055310896046647794042358012], [402595212660302393950567993882563109674401674171255076578131682037630], [528555060649504276885330474668927477483160773537761061634502014319586], [-1240213632892650049406119475061014496023053805141452201634123931481558], [487664056778570511650493471801556648725210936526524246813534422627728], [-487064403222790376299684097973385718303938572470231696439062556391594], [-133211010136703640081973109543634152009816558797546681195866861087558], [-713020265896295320260745888649037389338631849818627399684691831133210], [-685156354917771054829638551954776355243717683419747744865197492143432], [-1082563521966688174396364778123631153421361276468136491711677386219074], [-208815902430380093152594303362257177218778966713796934442896613375620], [1343552169172875922093199557983094447507962476743535395021987564211462], [107982430971528280391721062717073038258679658567090438557661355053108], [-1284417793772385037386678106405534435034039431977075704074357394584752], [1561157553906308591987665972745489233225548089080827006933447650871702], [-167794779791529024437910219072564426767303700418584137534748432553892], [-4752208433912272297900229469383300935437240682807260776189839818358], [1318565496135139567118397366272381643700777342463369033262549669475182], [2387127066237782382577731757153950083018854088248228681927564161558064], [3078292155300023717685167618986175712122353160410918453828067650165430], [-2436836010669636557414985695092432993919187117524139130164662344893414], [-2253699792017366566681426463551584037196222964408610903472298702065760], [-872021614811012664702619493163067858309007775410791153007303962636812], [2116313756369420545246250017094824401237945301842400198569055024944882], [849546246415297359127909859194695881086342046751787378029851261323464], [-1074965755923606883995333286260580795798827676803089511601620665159578], [126071439851878401624480816965850994450840863925512332920368444128202], [-3708366015551352962899867073383547438342732943779131790085815932077072], [-4177894551645348288947949713689443621388178810257653654479327662665660], [1475411352107940104255299072827580204769710875532019905375706437344508], [340735965402809334736881080108440315677909960987026308202400573151466], [1381293587856104479617576767631057025566400471108902832430809335164622], [-4676120951081771234844711283934580846674631051106415522097469951177736], [-823412389243247293746497830899611525184539019976822884087313669025638], [-2733770162666020491541784469086567543258407122037204831083676396336452], [9145703392670309803306003155416917736914062767822035009789921283197300], [-8951923904001361190231235626422083829671817664481123709881442796221296], [10932864763517958042307052559698642695725265971078033165270769471688790], [-3359212080356390815757466622257729739777509844810533285576665528658872], [-1775824979661849037773590396557592197293513057071992087264599128706658], [1614895424136277489853366603017956935832842360966983028254254162440460], [10331680353415366696349288726343581459578310641902492352371011258896608], [-846259922304870992025613867644134460914165081328453104877476903882974], [-11192905842985812820126161656907558322749933282763594653723541777869390], [19112750572282518455242502631241892211404342094625382604689911241504762], [-2534582721916827059300564225288337654016360405411690443017203858340898], [10569502218360546887664097352433004516072342917493459065722987390642826], [-7082416063730783445065502635840972239229543311164543577467315909632792], [16117807560299577563080425865460167231534293014921891837808274547079522], [6524489860181516478760036119320072847267521764380728284277702474606140], [13320923313342561566286321987871114093626297556977564188105979777337944], [8460316781990067497091501781676007824208494882517687532740564392835088], [-17962893182151141346276332731407011857499081644372027813588139750320938], [-17835510432680163576866124833274900182281450513314504256737805731403676], [6828061234714126977396961646798382458815548582306784183200241205367168], [-34137629899745720857376819642448069577815158321675485391112945785622910], [-4989309149140777095826516578251952102140934340127205988517299651397274], [14172321796023063535577068711899151833349085608595174456173181117748180], [-28320128350161450618644615921013107043868605985887494536614527538230132], [-13962926669842703880449569380256887776963432492694537539808668903308632], [-37196541444341516477196896910749066675786690361063559919444362692231334], [1683755483549730488765118743649258001728476122037216995109671543389280], [48393967560753209631758684604416404858813579545316046780058292709827050], [46763512388166301899136127512175242164005828566141052585764783934898868], [9448936560853774216205815852232610816784270110657473979472186569578262], [5753660358856977516079698555316643370839179455511503436213898419972190], [-35935816064013272019516853493576697097510333559038009313328610936137534], [-13001388406627757628087606247396971736961889622556346113828080644609872], [62603796189137754425658204271647938013050195940538247748008353166129562], [26916475680238364779085951137866665987060593007937805868053018154745030], [-47740122832323718666119429207331916182892249645354735146127651744492072], [-30491041370292090256794756180399353487894119059613849915161089394202098], [-20786233478434929156135742904508851632451530154100175238409032761469838], [-840548927362418680045832730408713498455292841556382444805053288861396], [48845886798921528020773833172262835028348472712737044500747063374997660], [-50594683443736866031707856957723864716590819186904859147060287357699694], [71744662741704507709093087201838737947134754410485313214947844434799222], [89034379696767036632215260376563041087220867360568044894481009541432004], [-74903596928142268471602701810872692292869891897712570257443126281932932], [45921775119562591521171760159882015003181038130265703992128243959461482], [115536726290392487720944842445479405784560116269365482883325506846956622], [-69426832285414007131843189491663567372620995573543385400651135912463680], [-82821594366088947896491735840933708554341792597816328713211468414996872], [-131429993671894116073339033369342672504350067511169214700230277828344878], [121977316670535459823580676008140595717980840928525174773101510796735464], [-113874752255928270440764998645791845172290412790894830286967449008470530], [-147363606376574367875503315213830317586752860547621761617701075587251898], [-183910739217620838689051639773393070628032991565892143410833769336287472], [-88402737381069124523839604960928542400235473127768613295061234322448540], [109402032888814955118090170872868139999412001124203945701405391326277066], [-253499498085142641902996622621586540468203614435828994360181897205467218], [113292284634642421648844355457203264786807339900670974364486802623677324], [-262698861277126186824994890174234926266537123824534000573875031553996710], [-204721843341213635273270165869489830080300856538820067922163003285701052], [184573131915671533092101584466517876436991624524359728671027865343417480]];
    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_42_a_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_16_42_a_a(:prec:=1)
    chi := MakeCharacter_16_a();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 42));
    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_42_a_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_16_42_a_a( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_16_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,42,sign)));
    Vf := Kernel([<3,R![5043516516, 1]>],Snew);
    return Vf;
end function;