
// Make newform 80.18.a.d in Magma, downloaded from the LMFDB on 05 February 2025.
// To make the character of type GrpDrchElt, type "MakeCharacter_80_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_80_18_a_d();".
// 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_80_18_a_d();".
// 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 := [-20820, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0], [-30, 60]];
    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_80_a();"
function MakeCharacter_80_a()
    N := 80;
    order := 1;
    char_gens := [31, 21, 17];
    v := [1, 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_80_a_Hecke(Kf)
    return MakeCharacter_80_a();
end function;


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


function qexpCoeffs()
    // To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
    weight := 18;
    raw_aps := [[0, 0], [654, -1], [390625, 0], [-301922, -2907], [235740648, 5238], [-770917114, -87228], [16069950282, 4460868], [-64336264700, 7351668], [-325179929646, -7606701], [1271527374990, 444821544], [-3919703999372, 461196486], [-13902604548778, 818505288], [-18913182132078, -4473032724], [-14815226963426, -7033515453], [-110395791511002, 18068763213], [529153008800286, 14912836812], [-763910358617580, 122690464632], [-315869106561058, 134737202448], [4421881746936298, 197259831009], [1665950830456188, -254971321938], [-5013175287146014, -248953009068], [-4131803421027560, -152690394132], [5344763446168494, -196076217465], [27939206260952490, -3148403792040], [-28053290181929878, -10663485822180], [-39497866504835658, 13503509690616], [186237690656143594, -5420540279745], [-85132312957320582, -22007378712411], [194722353137805950, -6603806623464], [9568649067962946, -46182522418344], [690116964662942278, 5510422540629], [548380301579837448, 104614470488394], [-1756779829912020918, -59897533616928], [-1046445920740541660, 104515666427592], [278516937266406150, -183587090926680], [-1211680502188087652, 459387393509430], [1988761839321854222, -670064976315288], [-8273123912133868106, -243050112662085], [-12332260627086662202, 16205568960609], [6283669830878731806, -1174210735783320], [8883011643692417580, 849242058066864], [-15866976259930001578, -849265021100016], [-27692435417974026852, -1975200389920638], [10269304729380670106, 2985385377084660], [-4788554251490622738, -1531816659905364], [-1545021134013058760, 917279744861376], [21444603473168959528, -3368813310099630], [-2214577579344128366, 12798353693178351], [-76805516079291922902, 6612923691301617], [-16245601663517479450, 15806680450586208], [113066800138929055026, -4738996643350212], [-140525111762404046520, -3453586300895292], [-169859648792156768518, -146671872125220], [-49331360397454289352, -15766583766607530], [137408247308536674162, -13927864739459832], [67784683758979827234, -39855804179723469], [227851020305328882510, -15451413256482624], [639656509107135108268, -2544416252345646], [-212082582448150807738, -52645754437729848], [-530346168448473325038, 48132179697847140], [372230396447534903134, 545936499460971], [425844368372881531206, -90463962065577840], [-889824351983468639942, -157868935358458815], [-463630943732349069132, -13076800409558214], [2339842294417079130026, 33766760277547848], [160316795344011111702, -133561663118853804], [-146710812758906294192, 428748882454154178], [2528384777623330490402, -249851963699208360], [-223513599183375587382, 264839086942802181], [-944211052752968107330, 145308550264641648], [-2788436927114644062414, -472487171968969128], [3718720817955906140280, 668821472606826576], [-2439687651153688548482, 260083231896840417], [94546349709098460806, 100744439284491480], [-5648913994601052555140, -612051855474595644], [9856403301254668145874, -43321439784833793], [2274722704749800930310, 739905743215829088], [-6636357671373755362618, 117467736042405924], [-2693422604535737893038, -263949184252012896], [10178991092401591890770, -1145048691291617916], [-25117823347298151541140, 923311426747683672], [2025705132865018741142, 2905930859707526760], [-10491851250020020414212, 3923495556341515290], [4828614034185615475226, -2737706704870354452], [-6165846147329819943800, -5662536636180367584], [13059946127107956935814, -113943883118969817], [-6546769475947952507670, 3730088040411076812], [-16111457997480505259158, 693560317568609520], [9305833799781817017822, -880140757758022440], [-11143239445219874563886, 4497552485934125463], [-6951601536133995967902, -8745301110706453251], [4255003636835243946120, -3485299921937232660], [20299462066060200634678, 2446805917876125897], [-67689426862970171760792, 4253529291905985606], [9394207423082625925540, -4829603244082066764], [-57299201792821567992726, -766178374212042633], [37387733556511557281790, -15099358476033806688], [73267948478613378933642, -4648880050891966080], [-35957042914073557759826, -536312678925905973], [-87474630057371529184498, 5247291766842125928], [81208713862816741185658, 13849321418715666537], [-3328473451616284302498, 17332404499113366024], [229479050606861768764974, 12731871818574192087], [82619541365309254956690, 21944194013929920948], [126815982719347216939408, -11415230793589342230], [128542144494745578756002, 29816343512277165648], [-342844612219942583934942, -2461182087543340671], [-384536249900248983160014, -34900540782641148528], [227875913494980723418560, 17900529531110831124], [56738985099671981538482, -37324836717042353868], [243760831009187189870038, -15302727520431810723], [-425799663688434309827554, 3993132070458743076], [-454744628648561782426638, -13616097404826682980], [-467897567181541491390020, -36760782846428373780], [-323269913510876439955172, -38052686233961289594], [275610320684794121012682, 50259575804363541180], [-806410604046288134678426, 66084898211180386227], [-232931382228099615865002, 9485964947868780393], [-80262944231057226874314, 17060338958224837932], [-628913001007909280584500, 64427460256442988144], [97838872891688060644982, 184834014187604067504], [-572523439694184948376294, -95403045663492967260], [-239158352774094859497378, -80794495152324656604], [-302597508075866294338866, -107414300055184556949], [-397350027375221613556832, 1651122533576901510], [960321592468843804067982, 77623668532264356792], [-1734062197436300924496010, 129901970871708860232], [834487231204991456315880, -44509139563950603900], [1390657858040755596294238, -102794206767915524067], [176380418403613340083646, 118614946349236072176], [25206126136562101091020, 250539907945764572424], [-1067746852911846890114406, 134762403683187807975], [1368271740278280345485908, -40394084518248683346], [-1268589026986616198641738, -19786594326541515072], [-1212549404630062391265798, 57421113860314043712], [1546480519207571913967250, 37572550145517991032], [360347407559496473754606, -257618117565371474100], [324455694338066440577218, 342889952931937358253], [-5024988809316120400232058, 141391418264453576268], [3578487592603897838888490, -253115888853693123648], [-2734257087098867542108952, 34660551578897602278], [-1461883032345374260857498, -648553103673367552056], [2195702493498311681546434, 360212335370314299531], [-6405616664765641335807942, 146778785683390949661], [5748423838208709667200350, 568916624977435508688], [8021924739576849546347280, -178908315318151416972], [2589519599271709939670846, 11960107756782310476], [-1986396683326647156898518, 13693274060852157336], [6035462137486503263621380, 609515009009442734256], [4101798236971732852096074, -199963554472273818573], [-11089428706671913690597618, 495994944236189371920], [-17306451011179122899297238, -177157102338508782780], [-10687861964784797032190306, 789249227707282177215], [1135760773863660183335598, -1093039605878595078555], [-12985548011423210318167982, -722829859465079836791], [-1652583859634860386902172, 2012213598002391579030], [3512284503699583710088720, -1596074433435190644084], [1675868543641679050185930, 931098069702930268620], [-30500452781073821215622398, -197983013553582505740], [-15513590739688135156256658, 878985562074670096704], [-19884086301381899627068422, -437092036102010940255], [-1069791554344116398935974, 1174071213688508929008], [-19352795457025425471328562, -1957168199728805065875], [17634320419469514636887808, -916007309670854859030], [6992003780064623929211562, 3467739471629935891572], [13451844118160626249173474, -810854499624175632213], [-31884582627503630602832732, -2289613174488714360690], [-13959765738783978866669218, -1592367508624560669756], [46970923707778676277075170, -2371018587990993998136], [-13900397433910847706130674, -5097712533718727218572], [-35134306660301645201175780, 3324540280612527691956], [44690818923613858707846782, -2357709911254889980704], [1356482307732217228820388, -4300447391387642321190], [14255053275564013651062866, -251381871010582256196], [-333467073525890702571200, 1515771776707545568536], [22825683666494364672517770, 6262530815352893711688], [-43881257978771604941476832, -179250512642790348942], [-11323530655399815656013018, -111480489724937096736], [44491465320692039033472034, 2279119960015347563811], [-27868407167094331457327890, 329835591371208571776], [49410332650360108972183918, 1572426604184675777793], [49955700647076160723582248, -2971459050827508223398], [63737962527759745110832286, 4012345484602995009492], [16965198430938367053226242, -8371655152617695002812], [-44495162551668668080641126, -7587084461459710713453], [128280814771606971108070950, -944219991669234884424], [-60548815212005905375204978, 1246397647144733566344], [-63627037294072718250136346, 479535127431364697859], [-74794930570228320958450750, -267319827379623624012], [-58484199664780167939009852, -1111720490401483737810], [14822495877924511192311746, -14596740350369175638304], [-61237785620213295763001226, -5487403346651704626873], [-17653806774137435893303712, 11592141058745495227062], [-106508039725216116912948738, 9820729224372171501360], [54306646546657514526193218, 12954651824077948926693], [-69400223995263233951674974, -12425493575418788930652], [-26692974190495009246526518, -5973063527515956756588], [-2551517795987668968620074, 18701580692599476277428], [-39302125179764912073118878, -48756180199686530256], [100210783871419575762426954, -23490792459384105076641], [92881421748187692685667550, -28547576426767194730152], [-115995253289155523276208932, -5862940933978266337638], [-304126140681831256343468338, -3589768828065648213756], [153001247335501043754872930, 4589557034195406664512], [-11717631427411072866972300, -21595806430541978559696], [22466475207510144816318942, -30659975460487208599056], [-252905646312202190134439840, -10626373468103835181104], [282164604190947872746153734, 12453544176142301405091], [-66335842954518906919452390, 45268181431288598796408], [-1316491920001662617032352, 8741891780504405197722], [-215257381074558039985600678, 21989229835504675684860], [17477191819988982591422022, -16056833914023338133432], [-250119478181618853674266526, 17227256649077142932427], [90951233444198952680851938, -20619835077072764711943], [-299775751554704948404567920, 20671703305648515358020], [32349097818827197861712402, -37571330630261763486036], [-93696535386772083048626522, -6995085897190387402611], [157865298748150647792874002, -50034029667447122839008], [-80825045943330794487519162, 57019603373868778557705], [571194371209098342086790726, 13271398135275656996748], [-382453593947185223166133498, 6475651747793749640016], [634139143157369631575419840, -9566090577351605682684], [-221713449824238859024300590, -80679934728886177929960], [-32587538390687512616238326, 42266100072896336072187], [342887293565255898255937938, -71477585513103494432187], [84818601666609977552831510, -7821410324611202784288], [203645039123608023617288706, -19285275046896681248340], [-82388199267753076161468720, -31585427591749220389752], [39203983392173587930704718, -130601363962695743029059], [-25515884250620560997865072, 16294604114164546034802], [-163943135140835675445450154, -131801574374370792078804], [-1025699450660760201236921180, -27631503218609451374508], [-443105499638225773812130532, -94065598228283682396606], [-24710503109001473171922558, -37408498957942062604668], [-1294448113575687212855365466, 13380686195260375016271], [953681431243355745999613638, 45475228009364624695341], [-308113330502475233429975590, 46564027945773145559388], [525175665828747574533005166, -43916215770868172933196], [-45917478954995296833605940, 156022544789499491372844], [1282714702850698933320414228, 19974791947342895377650], [364306492914914417621934414, -82294929994672219584537], [-171221507890577450886985832, 121035911225098415081382], [480192522221980339964148634, -86933113486573366427049], [-521090109662019826686710290, -16051352852765660502096], [-889179932201350413748962654, 41485782098798972895096], [461002474232720843990664120, 143961462966371717659032], [-211464899104867150676825642, 234682442723082478175613], [193921752055826762331338688, -229146582168302893323138], [-1891482819025705165100211740, 59937215756974856182296], [7307833304905482812226114, -23310577547874549959697], [-634295426773995927843042538, -130233483489338592273324], [485735473314950699162694402, -78815191087211295731040], [524313357291694091934226038, -273618875830657468681863], [265378908620370237423172610, 98107794446555801670660], [-1453856477465965420009501074, -205720752296445564597552], [-1996505807587561960913652780, -21824958406042826615124], [-920131193756476736882802778, -86608925945536683295368], [-681543039975054834446430422, -95172834369273500655531], [1277542900441705201130632182, -87892729553322989716968], [-210711655911918997759143238, 220168515279367514091168], [-1814540777459239121163032246, -185205228909841768340061], [2581053958272533929359263178, 58095154492593657154641], [-2374170890841828052761226810, -48331076675232705884352], [-634978140778180666660662274, 108418076954066123727408], [1785789386839387091925661482, -135282422974719357936036], [-3001567184671701136134964460, 66203518144040598026916], [-3001946874297840328459792530, 340504290857509562983104], [3774736545676328191460524122, -27362811442051790383248], [1085023682444111894213191174, -19461035114464534393113], [-287482797634607559982024554, 4045563823846313066616], [-4891377236753026133075887378, -43965175303471222677744], [-2645574043900416738668867582, -149909918206914613499859], [-2957379607418674753787580094, -228773906818694380623060], [454146404977591134481066240, -269912358749957722377840], [-1439256538635080017269200878, -47090836193962716651024], [1361380290272062945179585754, 396848722189069849594239], [-2404420654229277156661586862, 113794212574208879674641], [1812627315974533252097504750, -540727264784045228627736], [-1764778296776312219061157918, 224634968067057567798132], [-3221820227448358089560983272, -266790843577717597340550], [7111761181452241970191294314, -10083543190099891055037], [7638383679209638315930675108, 26004040877369916099018], [-5498516810151952917391481682, 115108987092416474878341], [3466222840769835020922466502, 207308410660038304958112], [571029779526382300414656898, -847940833159894997384751], [-7683998070342418133801466492, -151287399570041776425690], [1819124038449801483505870826, -480634178080112519624172], [424721162847938976728360622, 655912573047399596036436], [-5920612079505530685599334080, 126374787113859768955860], [5851082438146537437195499530, -382961068174556001451764], [1769281585589436257522073822, -262349009436739186691352], [-1503849398481879475238657502, 1207950618994315026277581], [-553592151236641499087752734, -372682322144860905906516], [1851569660257428758123330328, -130705100359380449166114], [-1472604072937131119644961554, 738685534938935615501616], [-9593259502406664849103041810, 553394328051944763275256], [-6382809691819478389258233452, -1190643416938298406694410], [10843392449464408098578650806, 302435655417380840804640], [16741563847724214180489849180, 281937620508595935151284], [-15241414067065703702977883822, 143798125740763570807437], [6114352222408980765558525386, -1030839793437882535265088], [4175544819860411008098268062, 1460361670541804959642296], [-1431405070820135023422490040, 1598679321287975595260244], [-3665776658794031241356781306, 613809691290629157459195], [-5672308790777173367574124472, 2090742792921485240438430], [-8307841055439617879915275558, -1028006024339554338942108], [3340008893186045891909254098, -1979872513903419779143143], [-3100561116502337899315549090, 2142214336338178970509992], [-470298889749493555356525480, -1750202681831233233420456], [19725250766440785782044385366, -428464576552642139044296], [-2835170871956721103999392366, -202469995535782789905129], [-4052144594249865254180001930, -1855848748058552975674320], [6460675434265551332702838402, 62770143357228094103376], [18695402896747307789153457934, 50441171972047141813551], [2202591469913495058100994598, -3374187338687873218222095], [10323583687986892465146363290, 1301364884841520913284680], [1136382143324486060321757300, -1319947581210282580520340], [18427697912001678858298894548, 598797537331070683235718], [9399263973154227374490821426, -1434710102116466818283832], [9685731418455507886926572730, 691489908492231760276140], [-18915671223675773236286854832, -1399668945551489497951458], [-23007861856183296827311079878, 1436111440044116556746448], [-5639352639233476045776230658, -248221991773214622074736], [1103879243412229165814811634, 1724787848551016392325631], [-3307339762514345175743009094, 727202127330882912156120], [9905475461789514584673268442, 450784892223092287869228], [-2482373467319739325921801820, 613724286407769817154604], [24451323336368859199413965494, 803129288980776071290335], [-27471489312445295210632742442, 650396887213117356164925], [2968817625316061997610582206, 1252793802997707387750900], [9514948529313268990269110942, -2139239446900594759085400], [31307566638910941823457450142, 1875476524656250494466416], [-8172594473598925992382243640, 3271817197338624255995100], [6947474204376927323225811774, 1066385615923742729323527], [8212757568323196649770638728, 444054125310003759573702], [-25590824522185060948532710422, -371651378618040376164939], [-24063039400059993999714610, 5390029174197408759500328], [42689368136439634038481971426, 2852026029526535133395328], [42080117894888704536590458082, -917355426158241579423132], [16330691708604559376046697678, 5717363918949754344170937], [-3218710295732849441726952394, 4203109283357880731185920], [47219334370640571084144254202, -1372768036620088616094528], [13638074415576608891006524470, 4250960524152779356662984], [-65598891053864812235363363012, 443685709716169881681774], [20290007712793083348289765326, -3570780290243293146132792], [19665435621808468897378271700, 6588669198743733935305476], [44833270581188415701944673222, -1273527307697180889993264], [-2107333761803771343468298502, -4186262455926045494588667], [17270493670189249457720170548, -3667504194943024092499170], [-5410317317136332163284160738, 9218456019947284370650188], [29887745817417483935016701368, 1565373538859749648168914], [-45127129218101261601103492678, -733800069556770811982904], [-67638359787377624234753077938, 3511743630227914355428320], [21250007633101884938938992154, 615226918113839344760019], [24516195295502118336960394070, -1303740848455894621664928], [-54971221130128571953451489934, 3398023157126303255864724], [-17829986833336737788713026120, -2004494505937370695149228], [-33425605597815664610234923872, -317225469520059601090230], [51777443358698217193590253962, -6144714800889755609944620], [-62628468862531541127032769126, -5153048078173321535166753], [60898679073759073811351535422, -120909521852799464976732], [-56295796182957264559598482998, -31806979430213447331552], [-33449865524473323348726764562, 1632808218561741841974489], [-31430626998534450913675842060, -2249590162966983920929320], [41556857713951173801724842418, 2421236590734936237832557], [61894812613578694638515625986, 7017990462999222685117812], [-48515862502784596304828412618, -5477475169988104410412740], [-20919912785061532902144305486, 15162207334840147129922763], [5363822651864885928126983522, -3109272609649588586324388], [-71875321288577526973528666152, -6815873086792950255958926], [-40972853052484098213192691460, -8004135631697469525210228], [-48928313135143184473934779086, -10151160358361693842397097], [53237588588901939838943224230, -967979643261323282648568], [110500110632384057312315568508, 924586139562706651477014], [-46246174874730897008699689258, -2700493234520706656822700], [-7622878111345522379106836700, 7552348513298458139359332], [12991746118291066278581032068, -11418260619712443564940290], [116587605707282468717252082146, -7836148059305114524234464], [-7112383557609175707800117190, 9557794475307990299223900], [-26265612880299825153171099478, 16563343075274881888140744], [6212376713629439165874567102, -7791168168399202365011616], [39183359052970113510383720826, -13276408699990146561063192], [80462280040664961616331051998, -2317522891132313280511587], [173551307947002413051521338402, 4387857826330897733604384], [37049960720290410339990641140, -1274205549331778855458860], [99377692273323090006065305554, -4154582122801165628540181], [80418602575833336362520552028, -19118578010178416818460022], [111644761240475676565654396262, -4901820229607053575615768], [67948807372854072327648773974, 2416715764990852352809887], [-30284410306606112047538132442, 17935606898350522824151269], [-62680259955006664657191525910, 17974731382787620361915820], [-12586098215140233276256422954, 2389455961377377909332536], [-27412529071827702475718644140, 8978356820979671252185584], [44943213422598362001453606178, 18801170037355910445938493], [33983976071551525542013716588, -18786565956967058744758386], [-184108365011965094763293549734, 2644871720556878124878304], [35439556031212961524413933880, 6678347819157854420881140], [-59668207876244770398056311830, 14379724813901411999657376], [-119716238763960040058698600712, 5597951504186232506068830], [202262019791572748452550890422, 9838654717266273846619296], [36378187904490387683030099630, -33308246240768141057152728], [222263776897117756234685416746, -10947617128442215574612244], [140653286058001560985609642558, -655943855387652716479407], [-196636825418692822107063937638, 3716134908393537083819232], [92272576661715394579280628870, 21110645333387011905598032], [158965977923742538363609258108, 14814174739048981136609886], [85115552627328648200861749622, -28442455887024038009990340], [53355975309456221777221408722, 907670312144410782369168], [-42692144276093793241418201906, -17364852293334790306180185], [-10753292673395958061232632260, -242281876522742461904256], [-164982349348996657250846121214, 23876349150585841843921992], [-146932238187526642536525175578, -7268763546765387303099912], [137572847066758530738216427614, 5696144078859754518042603], [155493548314103206124416604488, -15487420390900631393053734], [217407670166689807722384928322, 1650844594497023535237012], [-168789963915838964837368392258, -10574306669201849541753192], [-241367900883330619533245945280, -21516496897331249172204480], [179026689883538848952308030678, -2833681497157115319609783], [200939759667145258772482303962, -13457679398104442479659684], [-224715870792284379974143492086, -2171376357385706779419657], [-279901489973403096992018973570, 5302746352093453807034448], [201389624291450617341907635902, 14669342200918971940901076], [206210751333630541749878062518, -28992218345585357482277595], [-198670810322749883384295274140, 22803389667133687826094960], [-216024716451865709047209546454, -20250258109763596936859664], [325503580289316813739814282622, 35249189938355380101308712], [-67440961188932034930030792186, -24919777001118239377478757], [-379512326181246948758394477390, 7383207461355405109934676], [-45002934058742500411297572752, -42816446577861576004615734], [290969586369971202474766483560, -2805495276243572012866896]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_80_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


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


// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_80_18_a_d();".
// 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_80_18_a_d( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_80_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,18,sign)));
    Vf := Kernel([<3,R![-74525184, -1308, 1]>],Snew);
    return Vf;
end function;