
// Make newform 33.6.d.b in Magma, downloaded from the LMFDB on 23 December 2025.
// To make the character of type GrpDrchElt, type "MakeCharacter_33_d();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_33_d_Hecke();"
// To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
// To make the newform (type ModFrm), type "MakeNewformModFrm_33_6_d_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_33_6_d_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 := [9241272870780234240, -1075523563426213440, 169639595563975056, -17336133272224368, 2168293345395660, -129499271268696, 12972600642204, -835758339660, 37710373995, -2121785838, 91115757, 53946, 89670, -642, -195, -6, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-2950327974140691481600641210208169796166505704126833695960695619749050953801064595781504741364404592, 357582373267027102923465944398757086263970344481430029785744331985142303407091434722578669169234080, -37229535694567662416533490468206164574903326419617769284625659207187456781194551069526597279976552, 3581512672049993910224267447974258672148676602860564197074542657934267606882721647910376779970656, -285384709367031487018387434101930351710067874608494550913093669157834563425681538340900339064952, 16951784322311642473552227492276180745852626674056634848159803119323731212766880284633305870094, -904074730824652044367498509511060792056770075520190095257755988399716700953785317106945575034, 39431188816966067839279357797152018866535803886110970542743104795607223934582168820215466297, -869440646620904969359120924016969537256108393323873873864460823153719589824299192832003504, 17477348095215308295695054028108793039811903092260083694701348748027024971030170741198209, -333436705215481994612428905083845093242562585071342744449762485285559597573767616649390, -86932582332906324184283288018965255193378416360216767105260022745574497617787333066560, -385777819321219969074497359180468886069118337156466081352090529620090784618463522196, 375261166811954734602488530237032590058766639239829615017145915924356879292926723011, -9774677003138022743051395609268406198174317789738876672100903674474481557964169052, -150713479084399610545526626627156640507808701226283929427972049903399423955064879], [1623104234352891623651068534120555151641541987493219179455475600872143363215270393152002474411172320, -17207858530648264521094938489644136151195581683738919016058353522531582912381535130316280820499680, 13610361008710509825263343572240147563702323976840870614216595746698409871938025869131411858083320, -971051571635186827265705594688624784528043707988758949808894497483319657480876532042079370415872, 123011890214235885093992468087976714776743847714820074096340971610452930333911346807984034448464, -1472347516933301235961117345602883861016868170134583925865337869382996249088931286557517663442, -19596219636436556051736162651080111029795112330651709145626013944254847267977122891689698202, 3107664013924985796442480130560779576742826859750383709763335417380975366956814987587235745, -1357242006395606355119737398015790163093896077838623287698431096610445978370731816944168152, 77687580082313403420834105057013177709206793593866494054277088629516160325926690885373769, 698812166329889669020829543551785545591955693834844135036212904744448957220397895993466, 167008666482758195006373638874501525237785753934562914545619639342583180296747094252896, -878591105499574475830713398958187008428833392735206880783740737178168709216232393236, -513173829325716215772674670508058297395614964009260225687754481135724761965892990485, 4126801087279268239506808297369927356249003631644758578514960619137191696607080252, 1149383143339571506011030320719719756492589336047032713374042869184801607413779321], [-1623104234352891623651068534120555151641541987493219179455475600872143363215270393152002474411172320, 127736444095400186092028726573220297619993316181286240618716837394894010295231149683033126047586512, -13610361008710509825263343572240147563702323976840870614216595746698409871938025869131411858083320, 971051571635186827265705594688624784528043707988758949808894497483319657480876532042079370415872, -123011890214235885093992468087976714776743847714820074096340971610452930333911346807984034448464, 1472347516933301235961117345602883861016868170134583925865337869382996249088931286557517663442, 19596219636436556051736162651080111029795112330651709145626013944254847267977122891689698202, -3107664013924985796442480130560779576742826859750383709763335417380975366956814987587235745, 1357242006395606355119737398015790163093896077838623287698431096610445978370731816944168152, -77687580082313403420834105057013177709206793593866494054277088629516160325926690885373769, -698812166329889669020829543551785545591955693834844135036212904744448957220397895993466, -167008666482758195006373638874501525237785753934562914545619639342583180296747094252896, 878591105499574475830713398958187008428833392735206880783740737178168709216232393236, 513173829325716215772674670508058297395614964009260225687754481135724761965892990485, -4126801087279268239506808297369927356249003631644758578514960619137191696607080252, -1149383143339571506011030320719719756492589336047032713374042869184801607413779321], [335052328805032950685225345233654313191232569648989057715800641878907551611490115328804837664759413664, -21581990139902289176715431163751715883538467984803191052450810810341972107601673922256067571534438720, 5795260359629340257396945364512999601925793068396145314172442015432772957734998060824703739906262512, -268814736838470552468487108355097901374972363447669300590881365043774844814982397312165074875012744, 22721213788351077745739820281637401954045273070597896497025917796042966291738824381062294506644128, -1278840375678219703653196730948934800138808915545269910856174549486296298428261449695726536496198, 21759098502658575309720896313766244952001480647497554371151636270318758618510406941441880352988, -1392446931594427464785580343089339240368642728220867861302401818170327964846257643694699047733, 282810995024670257816205307810263575811449700679934535991163488872246520716641734014987059790, 3916679122536035565899615020414385358485158073147136909275888783203981232845035812044756155, -60477466575637778004743819941840260833795774959520465771036288375932004448927269180238174, -20745930133327069329305291445898520915514530060984689489707141430661619897013845928994364, 161663333352926868651726386419831126891323716286217726357297074440285587076133045998370, 41075861683416237047100685118380869055785445603364046434310582876856797587691339043809, 1489580885688585653973837237999995858532696195914868605370852418281160256387512991778, -32202326698575638566508409765577759156416274775055968270410312771353960518801754569], [-142753477220882199799036980494554797208708298380680094148453888662976546728966300002424479784041000480, 19392646208033033633322595084983034028729239291312803953578022854473288979038558632164477783283961936, -3216896889654193613634017428837649998616204439389266042016127764271596784798150940379633184286386768, 105565719296154071223697777607797069715105699439337310474188075348822429079832892557958240425579024, -20299246375082986779089940040440378592306251219421003131775338753393959529697916589435460199629770, 1558991327956796439029002197717015713797210259728138139743527167574460006247161180823515082356404, -63506016751995553197353344031638813363276843662249196917794514476832512000753116815334816466781, 5193697868743997895559861582007266246628059384719217133393395626808801737899595476472085589400, -259153009064722272122510441283191848967627952494262282523999346640301548215763190543201551429, -1142149172622499723440300169911676934268416055173854914069673306114489109440148933534377872, -362996022799083938426291498141424417063472984687940927355318947757827660184198676204845108, 6429458292592937054699290328405328033801460340002447794550897865315305857465824016018174, 989785875656112584396095688458003663159160078854956702332218379449746276084338161156317, -2394607051527983341494956339974013551464968969189572806878822870688193122769023420528, -3178038682396851065005125044802863283947541805521836149930624408407089090491413627977, 6727377021271954418732869142342803869242986655205270563772095756338796091038443886], [30729958009036179803949059101437601398106511331205247657312200891403037237202458409040820154760533536, 6195999864471700354652308107295507126569282991562655667750830657790166485689965742817918267453163520, 10050703649920489697516055995339399161205735100629930948144763931053906017217242137110449133298272, 58587158462181286611272757269229213124728253929103586359159416740564773153774978913988063457334184, -7356900591140775766319919229222056901240701571487948828455153363500751384156760173664225283189540, 376775936570960305339327806469832091228769080613540742490322122102076706160205861181002780384890, -22342182795799032162245701719336332761598576489691764652596933186598941641211664635919202400940, 1271223222752458172889240004797862915138506182212128889937903355586121423802868545717376752369, -10087954340217765562884459046739780571107978500791635778223682591445129544697327565467187834, -51650213211580340290865475323596412555979644309539895671060214293411443859098128272979019, -8490666572438099677391635028206329069280151903496162506319173619474761929611828635961390, -4229704907300779544101203991667890921802615140356158038825406192250239217143579246732544, 5386420678871445357122184136850713780192802557442749487977915408734496105253849092806, 14952377602195557979804777626271150304418124653105206014828684274622348481294415721987, -248000711696977148624898771083858087613849157172906365804916039543143625159615399958, -11159325546099610583194275263326227218416095478144665407173556570044789567115413967], [23533561718515091496088977927407818407481653594389723071024753670024328788722767427629055211365747920, 1781214263285452821806872544908086755206264002861025584575012887976212331719305675756195163560638952, 4882100550960411726350227701791877132946679608809532033320289367944240972738835845868231183115514716, -98353560053246121815048699430714838062665062343104675027842430589914451757614133716228740045916724, 40390554332415829343980737096177656399733584528719769915891478834063237399951103115316263043307194, -3902283126815003411681958894220271661101868640283105194784496418419590773790386675436247182774622, 159144237675599810303041082986831589192008729692688783835482018122529324299530323111449557070618, -11966986285491529058145147394662710648685531225494500025535140466872911881338825323201664128587, 673719512094865854246808041678635198401887258198780507818684395840299881872912552795380030882, -343773940383228665680940811294262390198126673939331976001467597055936925578757560677940187, 687018065392641100082164689044167420906692794513181888063160389705114560249744805742630956, -7443116513087453187254634352448881006105347071599386214369974911447910790547673541571424, -2165861457280675039171277082441246054980329216277104958195457291205866348737602746441468, -3393803453594862605547765659434303570988774388869977877522878145223508260458081749053, 7489443148172410088027849282349676990912000989527363556279390913541822272846645774862, -15799545073056547551158033171943574685072949034338844673265447603273958081755883223], [160496277462783699150734921008151156584748751351763508974395040635184210217818229267870740043486603328, -33376762065689707530109676275171136314352528061802550750804012429405256758117549875192068478626253440, 5846038448322728192356049008474041454270774221104750612726456607921173594680857229586988871442768448, -395254080405456594805372964522102456506430609783208416993071060789798361320696235836809466062649752, 51103771554338273170654167739807423468394414850550781712722012268211747441224666549592881958027224, -4375769414641514727707469135392063236599662037318003264052167836374512263895016975165834918708158, 244575800248807852420699713465993056215448425474610707258020340680473234187302739559166818740312, -14785325882379425752171012671918714505953328886247807227966013145908882998401209302050702888131, 752404012215691626572555151443251764674264774141778645812248467884045703499014111495514215438, -14558761987709728120579239006692237310919431435525303416555759056243537370638005151496342127, 550949223884008206491226330410089137818593496673077167458331097957211769871607941259433518, -17650702539494665536647832591668964937849178186529457850559873565118696298228564317956272, -1441273372192082453424247458072271514738808536703318086933776472728372804113807130920846, 23257570190436072195572620443052747057198973692130101069572539515570429133778263241471, 5776324908699755321544689291790052228294749413660680572280417914852613090900246880370, -175497751676977307671835741883298442680371268958840863569235981751503252638609863531], [15605468064635313182253917672402682376788376634481291343645960764199702592953403637393918672, -716177485177330726036741477689736883672259777339092869648772856493318122793261779266426880, -482568885781844889936770755284418210694167011849106412369085906670362019322849007598389888, 77931013074649429060464152994855741055708169532097010050826084495531888019813076365411744, -1067473778918961935862403503498949473578665493552787840745273709946103759557873360925104, 638086339770091259251191047781374638858734810577004833076452465406615820003549537959256, -41445446478780073968244899306862912323610410916681756582569585297122032144070438371212, 1650786888316577982309512141193591954822696123465694758460169355786788730795308082216, -167508502669252342469049159715247468080359927670303950483206783660892001554386156292, 7335276114592925543077999760165752544801489509323783581881999371098164792740793806, 80037583509972919980675082611451262227815038562849569328287786281419345300135177, 14409578191655349012336539253277409100355966875993243935726782241422255815273654, -183543991206340240089116815225197154768890591244713331197668877695757580601457, -37171140681301337920441323279935221822421513211827580922191496945124450007654, 11153623577503559540429674466629160411886525070272783361393614759837828991, 102699151312846501482479905506763556804222809375305910179476431423845673442], [8715623579043844955789608243642939780323186151884372190017798554394158536011252966958513344450340224, -12153460983783205294113481524728316999384218444651249463195749929968589458371137739529043177762165200, 335193163190526199903892611965384466973779508760237436223672716969184011875398883808262851060224516, -141012804563511781270543549246577816346039642033823781466985427762386975960126917767680511399940852, 6845336101087728268484838117738727108110441680345991460214214570203328938779249338125161727190432, -877256295616256019143417546717364072519216214725591310044055944698984405040177704571685690588032, 65896209886923475550839314941047827979006168269404288885781913483113185956413476899844920693389, -3488048579359753911821071966202916702726469168257378288496926317724179244986866627007757173379, 188497653051454721164393307552063556374211966334747442285612585093291674599125278931753592909, -9495947727490944975366980757903405739594832294769267418422096696730445949842388128113375149, 57952483640932418642115119608525509630660726852191150450976438044653499208181969634095152, -10625341920508765264527017716527128933910336311920794087477149407731732815655789371976672, -110798703300397138246685158196834560819514146519870376874468296666458570795749670557147, 26554750920789827878900103417855639441977283188248444944793798049493478771095514638919, 530508419803863297180694106014323471687189046337091112360030688745567896024843602089, -108835306639604605921406728605563872497999706058080340180490942209626219536251939255], [-1918915392945188239845649808374447131213103370316636445524409433083058373820459874091765321946475040, 1405863776976312915598258533777539788272278013794733796401266272022611350060890802470164610324889360, -177383711163951909464359478314706232191646739000329669059651856263653296753053412112403854538589936, 19356026430330876816937780179361520096012129895478734915595151809574221795182331857436745770204020, -1767074135000167508167733048148402858091469043723837614171042003308271045090553543596121914590902, 157117518187052577026282813037065779041767623765830900078721376680182833097712460758856710990644, -9567729444630228649884493840523671540843162170624991004399570480433194436771976195076946277671, 525324138354366801949634224249909388258365279294805192475661842044035591151215853524139405673, -25680588267283429719345643110737764432651010344597054212778756251516007844192703692594937753, 784339699582871365024016215325590706485662450171787003980546878618940037773471524903629827, -10861796767974438629927944165115206923146933732546360691534619876682968682050007960625846, 796913931759248004725064381765477265288358505885363884217193261749888948759778481294136, 25876650795271362907794743057015868863567745411926014124351958237347874627000977128125, -1304714774516052453058840614682323842651355487188022491905458644771115627601265413313, -144151671064670840585812151086978336072720742983000219878964107724420317759940945501, 8921961207438671684172367597253137681028631165571811028543063484936880243541350617], [-301663716974059443353565457461728159364993102196220356159121010674705508973280671792955523355926764160, 29227465162901190241236318028402588200812543144077210602249726706884017998454185983668715955699752672, -4444434269712211677268020605404184430561514935847303847241773362804883456039882587565016818318559336, 387624459461642465287324503825578191519198901226382359433635718731191315200163585116196307243940368, -51094389859847922966755807286141434490401185685901642957985291999300592471444003765242889126310618, 4502350914314308711426213836333835938222612711127298409692309565561288259959110612769989632871142, -279118451013987267157474295163841686423428200034224088732346892761536049001671212503592822897835, 17259544744050925223650530763645330151022440852674112071533146290960069286430124645910470999743, -833696088114256349355320744474854646341878543628503681422367382716634551838065964505126200893, 16835893075430023024386277747558498980986034962244996466922212385864830306510406469370745103, -703172273433006305387874674385225218344970106388906006243920445671282020901026303914241598, 12386426161479844915319358385387282614408940376687192291686748454579740534215905392466942, 1901385994703660566526942131874562208683808980847066579410705609572886068586782395217481, -15711745350048969648725074791730931793109033126849530729214864518688186558627128791091, -7020590488778786958162313564512821381698143686811435767901398729525886385311352137797, 177774488007339112700798635590106861594021750980325654884482879296870471623509166365], [-18173262616771292066274870128539458813632888157832721590279059297866686953505764836008558270560, 6406776406018532043692946114655288821409643900507749981896921143886462777785327205054148493616, -458942930448872145052436015742046546070238745271460302624930113234839551031653145757307185440, 79041725060546226453535557124243464741552796637644898273460260334803529305408936669372023320, -5410006917142302145080038897162628145147993724551647168449583342447895948891720809457510098, 542258261252889399933915520638310289514054565374368617932019144691001612266949489274485804, -38436659608614389164124040114665538538151983818615073928826328136835733684572665671349925, 1826371738199681437486131205710244246050330004398034198114399316767327662168104001423906, -99180651599455468251845145848265909072048694547739995643963835535521239801205556794497, 4685877634594881810394940500871003272430200985169666422882408403700012410656427802326, -14976570537877945919553810093082995588196059523287745719524708598212374892162773008, 3725152517930042344544006414056670183941439929241557520159884744535195648084443554, 11778509515096963672917290848527688793706987123159131824185836448322661274991281, -9300098146880022918843722951274583641885117279722709472569772316078405406662154, -296093477896950852523257997807671397986181735766603955513567010790010096457733, 49511464616933368431195818238846408268025057242241124063242477034124844029676], [-328307517047576333737891044093311481520629979653533561292742850208770671150562054351884699492242720, -82825792106125275254805808860946167614371817886484358430090565149680859807915186161455299313982544, -30131673726230877991396607152123176458003733387696735171054157480632826631572080227408915158670664, 4807664484742891962645387527151985113706266422187094958522491977459626793028700762755494554912832, -45830675448861148082878045920957329818946447569125860653125792247234899029414904448644869060304, 35593652227407542734648945530850523895784660633994017117594975808767808740660390529222265564558, -2664690836093106717212117690027257629158889243006935501469029431984645741043622700897826193066, 85604194775172695339577036540209773200362087703880460036191421496834174957051836117835938841, -9293269446264488843815736630721607249520186687793080822270715190320144543473353130108216256, 417507656589951648368137356910483981860385863361893460627390278202601897794835583507071781, 3214523597067787594811664356296202613552875992355222051288892549547250487725082539150850, 678379277938884600498113593218131827103251271024431157692834569633988520123404451938464, -10090043932893022249917377033235034458006900706900923208232113232668785048891599570820, -1976632349077015074257630591798461649926176767640969625717544684635952707231219036565, -6980843225910770455037192973319927995091837212892833805234884839635722913341273076, 5426655139008503872221245749844096529053076849907944167757816346329271810400288165], [7368922279020324257379893943280155666903483941814542438318751278350217036088411189361304930912938152, -1648089508774370395764815656241690807023931124291231134328149926306860294472594808264532596671715760, 286916319567652729452520983164313615532682932852399499277203890156289047055366697453112651664731548, -87555904251157028219559260274065398615224540163880711238514361989430788431061612113783066719454780, 3991526119696854460790443698423234065019102984300162075213762905008553932693575062453826166767720, -693207270516790217259875387890157570346228446159139575376668149264269473986747174866459170512500, 51103365284243552679467883581641738566632675261777918866450036326612707336177833047252412721955, -2330214343659837406926566394641581632259096578407423816996997857432233233151344207086593565847, 146124551732573306627984713507148372933478039019853887951991610989978793364354760132479303755, -7050080311837958849380407268572980791966494896788975639344025743399271866360390564672469101, -15369363957150622123109201510564441960750195164869500164935650801030228247686121098639508, -5711721981945895721737962996484433766568510788023012273375774569310524574416551097504080, 22464908573024888613508065238245495974380270878240515412181794240467446374198585973023, 16000043776260439478631355078416655816180427410058813764651965989266278225701139786411, 334746938079960753551942271854109174809309692787077135453348630052798383206262717131, -73813403764203100027805962924494849263975877580142248478606694624026528463346316699]];
    Rf_basisdens := [1, 36842861854917307190311262694525387156265911499182440534219494624120809127616538184238948409028944, 110528585564751921570933788083576161468797734497547321602658483872362427382849614552716845227086832, 110528585564751921570933788083576161468797734497547321602658483872362427382849614552716845227086832, 1989514540165534588276808185504370906438359220955851788847852709702523692891293061948903214087562976, 331585756694255764712801364250728484406393203492641964807975451617087282148548843658150535681260496, 497378635041383647069202046376092726609589805238962947211963177425630923222823265487225803521890744, 497378635041383647069202046376092726609589805238962947211963177425630923222823265487225803521890744, 2984271810248301882415212278256556359657538831433777683271779064553785539336939592923354821131344464, 1664196947991951549235170104749780374818110935941213686566054571307173453411549752201424299, 1492135905124150941207606139128278179828769415716888841635889532276892769668469796461677410565672232, 55264292782375960785466894041788080734398867248773660801329241936181213691424807276358422613543416, 994757270082767294138404092752185453219179610477925894423926354851261846445646530974451607043781488, 239644360510841023089864495083968373973807974775534770865511858268232977291263164317005099056, 18421430927458653595155631347262693578132955749591220267109747312060404563808269092119474204514472, 248689317520691823534601023188046363304794902619481473605981588712815461611411632743612901760945372];
    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_33_d();"
function MakeCharacter_33_d()
    N := 33;
    order := 2;
    char_gens := [23, 13];
    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;

// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_33_d_Hecke();"
function MakeCharacter_33_d_Hecke( : Kf := false)
    N := 33;
    order := 2;
    char_gens := [23, 13];
    char_values := [[-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]];
    assert UnitGenerators(DirichletGroup(N)) eq char_gens;
    values := ConvertToHeckeField(char_values : pass_field := ISA(Type(Kf), Fld), Kf := Kf); // the value of chi on the gens as elements in the Hecke field
    F := Universe(values);// the Hecke field
    chi := DirichletCharacterFromValuesOnUnitGenerators(DirichletGroup(N,F),values);
    return chi;
end function;


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


function qexpCoeffs()
    // To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
    weight := 6;
    raw_aps := [[0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-3, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0], [1, -1, -1, 9, 1, 0, 0, 0, -2, 0, 2, 0, 0, 0, -1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, -1, 0, -1, 0, 0], [0, 0, 0, -42, 2, 0, -1, 0, 0, 0, 0, 3, -1, -1, 1, 1], [0, 0, 0, 2, 0, 2, 0, -1, 0, 0, 0, -3, -2, 0, 0, 0], [-14, 14, 8, 0, 0, 0, 3, 0, -9, 0, -34, 0, 0, 0, 0, -3], [0, 0, 0, 36, 8, 0, -4, 0, 0, 0, 0, -9, 3, 3, -5, 4], [-811, -45, 161, 0, 0, 0, 13, 0, 0, 2, 0, 0, 0, 0, 0, 13], [657, 61, -129, 0, 0, 0, 27, 0, 0, 38, 0, 0, 0, 0, 0, 27], [0, 0, 0, -20, 16, 0, -8, 0, 0, 0, 0, 93, -31, -31, -23, 8], [0, 0, 0, -34, 0, -10, 0, -3, 0, 0, 0, 95, 34, -54, 0, 0], [21, -21, -193, 0, 0, 0, 16, 0, 117, 0, -130, 0, 0, 0, 0, -16], [125, -125, -411, 0, 0, 0, -53, 0, -53, 0, -36, 0, 0, 0, 0, 53], [119, -119, -81, 0, 0, 0, 72, 0, 214, 0, 276, 0, 0, 0, 0, -72], [0, 0, 0, 56, 0, 16, 0, 3, 0, 0, 0, -155, -56, 33, 0, 0], [-22713, 137, -505, 0, 0, 0, -47, 0, 0, -598, 0, 0, 0, 0, 0, -47], [-646, 646, 1988, 0, 0, 0, -37, 0, 105, 0, 50, 0, 0, 0, 0, 37], [0, 0, 0, -16, 0, -104, 0, -36, 0, 0, 0, -20, 16, -152, 0, 0], [0, 0, 0, -8, 0, 96, 0, 4, 0, 0, 0, 116, 8, 239, 0, 0], [0, 0, 0, 712, -48, 0, 24, 0, 0, 0, 0, 90, -30, -30, -126, -24], [-669, 669, 2083, 0, 0, 0, 101, 0, 308, 0, 76, 0, 0, 0, 0, -101], [6111, -679, 1929, 0, 0, 0, -54, 0, 0, -2232, 0, 0, 0, 0, 0, -54], [0, 0, 0, -11548, 48, 0, -24, 0, 0, 0, 0, -213, 71, 71, 47, 24], [3728, 1164, -3560, 0, 0, 0, -34, 0, 0, 700, 0, 0, 0, 0, 0, -34], [0, 0, 0, 12978, 202, 0, -101, 0, 0, 0, 0, -480, 160, 160, 142, 101], [0, 0, 0, 40, 0, -176, 0, -91, 0, 0, 0, -205, -40, 283, 0, 0], [677, -677, -2555, 0, 0, 0, -505, 0, 656, 0, -524, 0, 0, 0, 0, 505], [0, 0, 0, -200, 0, -280, 0, 128, 0, 0, 0, 192, 200, 43, 0, 0], [0, 0, 0, 12424, 440, 0, -220, 0, 0, 0, 0, 450, -150, -150, -518, 220], [-971, 971, 6501, 0, 0, 0, -57, 0, 2854, 0, 3588, 0, 0, 0, 0, 57], [0, 0, 0, 498, 0, 434, 0, -25, 0, 0, 0, -1035, -498, -1212, 0, 0], [0, 0, 0, -7680, 620, 0, -310, 0, 0, 0, 0, -129, 43, 43, 175, 310], [0, 0, 0, -408, 0, 464, 0, 232, 0, 0, 0, 1456, 408, -393, 0, 0], [-7289, -2633, 7269, 0, 0, 0, -315, 0, 0, 3786, 0, 0, 0, 0, 0, -315], [110526, 964, -1022, 0, 0, 0, 935, 0, 0, 2310, 0, 0, 0, 0, 0, 935], [0, 0, 0, -7524, -12, 0, 6, 0, 0, 0, 0, -1392, 464, 464, -2172, -6], [0, 0, 0, 46772, -648, 0, 324, 0, 0, 0, 0, -609, 203, 203, 819, -324], [3445, -3445, -5915, 0, 0, 0, 102, 0, 1802, 0, 4420, 0, 0, 0, 0, -102], [43415, 3359, -7715, 0, 0, 0, 1181, 0, 0, -11046, 0, 0, 0, 0, 0, 1181], [-142, 142, 3676, 0, 0, 0, 911, 0, -7123, 0, 3250, 0, 0, 0, 0, -911], [0, 0, 0, 664, 0, -456, 0, -206, 0, 0, 0, -2242, -664, 466, 0, 0], [0, 0, 0, 10624, -28, 0, 14, 0, 0, 0, 0, -3801, 1267, 1267, 1815, -14], [149852, -1036, 3860, 0, 0, 0, 376, 0, 0, 5440, 0, 0, 0, 0, 0, 376], [0, 0, 0, -546, 0, -74, 0, 85, 0, 0, 0, 1479, 546, -2602, 0, 0], [-171437, -1255, 6439, 0, 0, 0, 1337, 0, 0, 11642, 0, 0, 0, 0, 0, 1337], [0, 0, 0, -22878, -2374, 0, 1187, 0, 0, 0, 0, 108, -36, -36, 250, -1187], [131729, 8209, -29153, 0, 0, 0, -2263, 0, 0, 4346, 0, 0, 0, 0, 0, -2263], [0, 0, 0, -53056, 1164, 0, -582, 0, 0, 0, 0, -687, 229, 229, 1009, 582], [0, 0, 0, 24780, 748, 0, -374, 0, 0, 0, 0, 3924, -1308, -1308, 40, 374], [0, 0, 0, -2408, 0, -728, 0, -58, 0, 0, 0, 6554, 2408, -1650, 0, 0], [-13283, 13283, 44061, 0, 0, 0, 2010, 0, 17314, 0, 4212, 0, 0, 0, 0, -2010], [-6976, 6976, 11488, 0, 0, 0, -1760, 0, -10216, 0, -9440, 0, 0, 0, 0, 1760], [0, 0, 0, 756, -2212, 0, 1106, 0, 0, 0, 0, -6984, 2328, 2328, 1652, -1106], [10389, -10389, -37355, 0, 0, 0, 735, 0, 1139, 0, -6188, 0, 0, 0, 0, -735], [0, 0, 0, 748, 0, -436, 0, -1422, 0, 0, 0, -1258, -748, -6595, 0, 0], [0, 0, 0, -1016, 0, -528, 0, -495, 0, 0, 0, 3015, 1016, 13291, 0, 0], [0, 0, 0, 54354, -2186, 0, 1093, 0, 0, 0, 0, 867, -289, -289, -2227, -1093], [0, 0, 0, -810, 0, -2930, 0, 433, 0, 0, 0, -933, 810, 1958, 0, 0], [0, 0, 0, -105328, 4092, 0, -2046, 0, 0, 0, 0, 6327, -2109, -2109, 3127, 2046], [0, 0, 0, 354, 0, -270, 0, 927, 0, 0, 0, -2259, -354, 6912, 0, 0], [8749, -8749, -33401, 0, 0, 0, 5756, 0, 5897, 0, -7154, 0, 0, 0, 0, -5756], [828453, 11517, -27729, 0, 0, 0, 3411, 0, 0, -37082, 0, 0, 0, 0, 0, 3411], [-22800, 22800, 72128, 0, 0, 0, 576, 0, -13065, 0, 3728, 0, 0, 0, 0, -576], [-525207, -14479, 47081, 0, 0, 0, 1822, 0, 0, -9220, 0, 0, 0, 0, 0, 1822], [0, 0, 0, 1640, 0, 2480, 0, 816, 0, 0, 0, -3256, -1640, -6688, 0, 0], [0, 0, 0, 18704, -2112, 0, 1056, 0, 0, 0, 0, -6282, 2094, 2094, 12198, -1056], [0, 0, 0, -3312, 0, -64, 0, 1, 0, 0, 0, 9871, 3312, -10425, 0, 0], [13489, -13489, -42943, 0, 0, 0, 5955, 0, 26712, 0, -2476, 0, 0, 0, 0, -5955], [0, 0, 0, 100480, -4776, 0, 2388, 0, 0, 0, 0, 2388, -796, -796, -1052, -2388], [-1340357, 15709, -46817, 0, 0, 0, 155, 0, 0, 35374, 0, 0, 0, 0, 0, 155], [0, 0, 0, 3520, 0, 4416, 0, -2313, 0, 0, 0, -3831, -3520, -951, 0, 0], [1290553, -3923, -7543, 0, 0, 0, -9656, 0, 0, 24176, 0, 0, 0, 0, 0, -9656], [2650, -2650, 23480, 0, 0, 0, -161, 0, 15375, 0, 31430, 0, 0, 0, 0, 161], [-2562, 2562, 40598, 0, 0, 0, -386, 0, 37695, 0, 32912, 0, 0, 0, 0, 386], [-1181614, -6388, 18884, 0, 0, 0, -140, 0, 0, -30776, 0, 0, 0, 0, 0, -140], [-17998, 17998, 67890, 0, 0, 0, 4314, 0, 41806, 0, 13896, 0, 0, 0, 0, -4314], [0, 0, 0, 1360, 0, 880, 0, 1078, 0, 0, 0, -4278, -1360, -20270, 0, 0], [-14980, 14980, 66676, 0, 0, 0, -12349, 0, 32150, 0, 21736, 0, 0, 0, 0, 12349], [653174, -17040, 60512, 0, 0, 0, 4696, 0, 0, 42992, 0, 0, 0, 0, 0, 4696], [0, 0, 0, 207028, -2788, 0, 1394, 0, 0, 0, 0, 1644, -548, -548, 12264, -1394], [-1057967, 72277, -194797, 0, 0, 0, 11017, 0, 0, 8714, 0, 0, 0, 0, 0, 11017], [0, 0, 0, 1012, 0, 2508, 0, 1054, 0, 0, 0, -1582, -1012, -4363, 0, 0], [50359, -50359, -153321, 0, 0, 0, -8520, 0, -7910, 0, -2244, 0, 0, 0, 0, 8520], [-38711, 38711, 23577, 0, 0, 0, -3209, 0, -17306, 0, -92556, 0, 0, 0, 0, 3209], [0, 0, 0, 976, 0, -5232, 0, 506, 0, 0, 0, -8666, -976, -22674, 0, 0], [0, 0, 0, -327544, 10268, 0, -5134, 0, 0, 0, 0, 4371, -1457, -1457, -6293, 5134], [-81755, -34249, 98241, 0, 0, 0, -2253, 0, 0, 141214, 0, 0, 0, 0, 0, -2253], [-19267, 19267, 126761, 0, 0, 0, 1838, 0, -49020, 0, 68960, 0, 0, 0, 0, -1838], [0, 0, 0, 154172, 5348, 0, -2674, 0, 0, 0, 0, 9132, -3044, -3044, -15840, 2674], [-1624331, -43221, 142649, 0, 0, 0, 6493, 0, 0, -134270, 0, 0, 0, 0, 0, 6493], [0, 0, 0, -280266, -5578, 0, 2789, 0, 0, 0, 0, -33276, 11092, 11092, 19790, -2789], [-2482414, -39444, 69558, 0, 0, 0, -24387, 0, 0, 18354, 0, 0, 0, 0, 0, -24387], [0, 0, 0, 129160, -600, 0, 300, 0, 0, 0, 0, 14484, -4828, -4828, -724, -300], [40120, -40120, -114192, 0, 0, 0, -2956, 0, -3383, 0, 6168, 0, 0, 0, 0, 2956], [1503, -1503, 103375, 0, 0, 0, -11811, 0, 37082, 0, 107884, 0, 0, 0, 0, 11811], [0, 0, 0, 886, 0, -11290, 0, -4411, 0, 0, 0, -9537, -886, 2506, 0, 0], [0, 0, 0, 128, 0, -832, 0, -6867, 0, 0, 0, 5651, -128, 22339, 0, 0], [0, 0, 0, 6106, 0, 1346, 0, -2849, 0, 0, 0, -14123, -6106, -34624, 0, 0], [0, 0, 0, -120064, -7252, 0, 3626, 0, 0, 0, 0, -31077, 10359, 10359, -14485, -3626], [0, 0, 0, -222206, -2398, 0, 1199, 0, 0, 0, 0, 35604, -11868, -11868, -1774, -1199], [0, 0, 0, 1130046, 16130, 0, -8065, 0, 0, 0, 0, 11007, -3669, -3669, -6763, 8065], [0, 0, 0, 8850, 0, -11782, 0, 1939, 0, 0, 0, -40271, -8850, 14192, 0, 0], [-4813239, 27403, -22165, 0, 0, 0, 30022, 0, 0, 7000, 0, 0, 0, 0, 0, 30022], [-70380, 70380, 90660, 0, 0, 0, 2727, 0, -30350, 0, -120480, 0, 0, 0, 0, -2727], [0, 0, 0, -593846, -3186, 0, 1593, 0, 0, 0, 0, 22071, -7357, -7357, 11177, -1593], [49425, -49425, -165805, 0, 0, 0, 27864, 0, 27189, 0, -17530, 0, 0, 0, 0, -27864], [0, 0, 0, -8064, 0, -19080, 0, -1060, 0, 0, 0, 6172, 8064, -23648, 0, 0], [0, 0, 0, -948, 0, 12788, 0, 12734, 0, 0, 0, 2898, 948, -15687, 0, 0], [0, 0, 0, -19944, 0, -16528, 0, -1071, 0, 0, 0, 44375, 19944, 52659, 0, 0], [74308, -74308, -224364, 0, 0, 0, 5904, 0, -153980, 0, -1440, 0, 0, 0, 0, -5904], [6239227, -29003, 114083, 0, 0, 0, 13537, 0, 0, 156266, 0, 0, 0, 0, 0, 13537], [5343849, 153127, -454227, 0, 0, 0, 2577, 0, 0, -16630, 0, 0, 0, 0, 0, 2577], [-84855, 84855, 229881, 0, 0, 0, -24001, 0, -37310, 0, -24684, 0, 0, 0, 0, 24001], [-2182459, -71213, 210381, 0, 0, 0, -1629, 0, 0, 17662, 0, 0, 0, 0, 0, -1629], [-107756, 107756, 267262, 0, 0, 0, 27545, 0, -21799, 0, -56006, 0, 0, 0, 0, -27545], [-53882, 53882, 30358, 0, 0, 0, -30718, 0, -91885, 0, -131288, 0, 0, 0, 0, 30718], [0, 0, 0, -490506, 12902, 0, -6451, 0, 0, 0, 0, 51048, -17016, -17016, -1630, 6451], [-64517, -112829, 274385, 0, 0, 0, -32051, 0, 0, -23446, 0, 0, 0, 0, 0, -32051], [0, 0, 0, 17464, 0, 14744, 0, -4678, 0, 0, 0, -32970, -17464, 28026, 0, 0], [0, 0, 0, -475016, 24916, 0, -12458, 0, 0, 0, 0, -33825, 11275, 11275, -793, 12458], [77184, -77184, -130560, 0, 0, 0, -7781, 0, -64310, 0, 100992, 0, 0, 0, 0, 7781], [-6215579, -23813, 23869, 0, 0, 0, -23785, 0, 0, -132986, 0, 0, 0, 0, 0, -23785], [0, 0, 0, 919296, -14564, 0, 7282, 0, 0, 0, 0, -8877, 2959, 2959, 44835, -7282], [-5106287, -80375, 215231, 0, 0, 0, -12947, 0, 0, 178226, 0, 0, 0, 0, 0, -12947], [86548, -86548, -138526, 0, 0, 0, 51317, 0, 127383, 0, 121118, 0, 0, 0, 0, -51317], [-1866403, -60165, 257361, 0, 0, 0, 38433, 0, 0, 61002, 0, 0, 0, 0, 0, 38433], [0, 0, 0, 23768, 0, 7056, 0, -7479, 0, 0, 0, -56769, -23768, -17497, 0, 0], [0, 0, 0, -5490, 0, -12506, 0, -8987, 0, 0, 0, 12951, 5490, -48338, 0, 0], [0, 0, 0, 1431552, 6944, 0, -3472, 0, 0, 0, 0, 34116, -11372, -11372, -13308, 3472], [10437931, -64847, 201999, 0, 0, 0, 3729, 0, 0, 97962, 0, 0, 0, 0, 0, 3729], [6804906, 120064, -434604, 0, 0, 0, -37206, 0, 0, 265388, 0, 0, 0, 0, 0, -37206], [0, 0, 0, -376314, -41902, 0, 20951, 0, 0, 0, 0, -78969, 26323, 26323, 49701, -20951], [0, 0, 0, -15488, 0, -15848, 0, -106, 0, 0, 0, 30722, 15488, -12130, 0, 0], [-54037, 54037, 314731, 0, 0, 0, 35513, 0, 51701, 0, 152620, 0, 0, 0, 0, -35513], [0, 0, 0, 17686, 0, 16638, 0, -14447, 0, 0, 0, -21973, -17686, 91090, 0, 0], [-27474, 27474, 225622, 0, 0, 0, -61786, 0, -29095, 0, 143200, 0, 0, 0, 0, 61786], [0, 0, 0, 274112, -32156, 0, 16078, 0, 0, 0, 0, 58593, -19531, -19531, 33857, -16078], [0, 0, 0, 44446, 0, 246, 0, -11227, 0, 0, 0, -121865, -44446, -31406, 0, 0], [0, 0, 0, 517040, -1820, 0, 910, 0, 0, 0, 0, -18225, 6075, 6075, 89999, -910], [679387, -334975, 991415, 0, 0, 0, -6755, 0, 0, 265218, 0, 0, 0, 0, 0, -6755], [0, 0, 0, -43536, -56016, 0, 28008, 0, 0, 0, 0, -50922, 16974, 16974, 60006, -28008], [14761997, -221311, 720563, 0, 0, 0, 28315, 0, 0, 276118, 0, 0, 0, 0, 0, 28315], [102050, -102050, -276752, 0, 0, 0, 20635, 0, 10571, 0, 29398, 0, 0, 0, 0, -20635], [0, 0, 0, 23976, 0, -14624, 0, -5983, 0, 0, 0, -80569, -23976, -83093, 0, 0], [0, 0, 0, 609336, -18972, 0, 9486, 0, 0, 0, 0, -110127, 36709, 36709, -11031, -9486], [-10914717, 351779, -1021685, 0, 0, 0, 16826, 0, 0, -202364, 0, 0, 0, 0, 0, 16826], [14325, -14325, -196793, 0, 0, 0, 52664, 0, -274807, 0, -153818, 0, 0, 0, 0, -52664], [0, 0, 0, 37568, 0, 22496, 0, 11011, 0, 0, 0, -101219, -37568, -73455, 0, 0], [132347, -132347, 10555, 0, 0, 0, 16593, 0, -161572, 0, 407596, 0, 0, 0, 0, -16593], [2345864, -67012, 119428, 0, 0, 0, -40804, 0, 0, -441528, 0, 0, 0, 0, 0, -40804], [0, 0, 0, -189816, -33096, 0, 16548, 0, 0, 0, 0, 372, -124, -124, -112820, -16548], [-24178408, -112508, 341596, 0, 0, 0, 2036, 0, 0, 148664, 0, 0, 0, 0, 0, 2036], [307445, -307445, -892321, 0, 0, 0, -40544, 0, -78315, 0, 30014, 0, 0, 0, 0, 40544], [0, 0, 0, 10312, 0, 20656, 0, 29360, 0, 0, 0, -39640, -10312, 13279, 0, 0], [-248926, 248926, 808146, 0, 0, 0, 102834, 0, 100054, 0, 61368, 0, 0, 0, 0, -102834], [0, 0, 0, -41296, 0, -21192, 0, 9916, 0, 0, 0, 92780, 41296, 145544, 0, 0], [0, 0, 0, 3168276, 13224, 0, -6612, 0, 0, 0, 0, 38127, -12709, -12709, -37885, 6612], [-316797, 316797, 1059447, 0, 0, 0, -25488, 0, 385072, 0, 109056, 0, 0, 0, 0, 25488], [0, 0, 0, -1416384, -24716, 0, 12358, 0, 0, 0, 0, 95433, -31811, -31811, 42985, -12358], [0, 0, 0, -1940, 0, -17052, 0, -43886, 0, 0, 0, 32654, 1940, 25393, 0, 0], [-57717, 57717, -6029, 0, 0, 0, -10372, 0, -150130, 0, -179180, 0, 0, 0, 0, 10372], [324121, -324121, -1189303, 0, 0, 0, 99159, 0, 369210, 0, -216940, 0, 0, 0, 0, -99159], [9344, -9344, 82962, 0, 0, 0, -109611, 0, 313381, 0, 110994, 0, 0, 0, 0, 109611], [-11412824, 408172, -1112296, 0, 0, 0, 56110, 0, 0, 8540, 0, 0, 0, 0, 0, 56110], [0, 0, 0, -1008, 0, -44576, 0, 741, 0, 0, 0, -42293, 1008, -97537, 0, 0]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_33_d_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_33_6_d_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_33_6_d_b(:prec:=16)
    chi := MakeCharacter_33_d();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 6));
    S := BaseChange(S, Kf);
    maxprec := NextPrime(997) - 1;
    while true do
        trunc_vec := Vector(Kf, [0] cat [f_vec[i]: i in [1..prec]]);
        B := Basis(S, prec + 1);
        S_basismat := Matrix([AbsEltseq(g): g in B]);
        if Rank(S_basismat) eq Min(NumberOfRows(S_basismat), NumberOfColumns(S_basismat)) then
            S_basismat := ChangeRing(S_basismat,Kf);
            f_lincom := Solution(S_basismat,trunc_vec);
            f := &+[f_lincom[i]*Basis(S)[i] : i in [1..#Basis(S)]];
            return f;
        end if;
        error if prec eq maxprec, "Unable to distinguish newform within newspace";
        prec := Min(Ceiling(1.25 * prec), maxprec);
    end while;
end function;


// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_33_6_d_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_33_6_d_b( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_33_d();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,6,sign)));
    Vf := Kernel([<2,R![1887840, 0, -285984, 0, 13326, 0, -207, 0, 1]>],Snew);
    return Vf;
end function;