
// Make newform 24.22.a.a in Magma, downloaded from the LMFDB on 17 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_24_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_24_22_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_24_22_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
        poly := [-134385, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0], [-4032, 8064]];
    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_24_a();"
function MakeCharacter_24_a()
    N := 24;
    order := 1;
    char_gens := [7, 13, 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_24_a_Hecke(Kf)
    return MakeCharacter_24_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 := 22;
    raw_aps := [[0, 0], [59049, 0], [10974310, -5], [-329725704, -233], [-14955448436, 41046], [2234433406, 133514], [-8832702360910, 1743998], [-11233989648748, 1299182], [60497636524792, 50101454], [-1659066903355842, 187750985], [-3491923002900784, -1483778957], [-11711517185396394, 7840707368], [76089703172667498, -22500813782], [17568927944328940, -58223762246], [-42175267059004464, 103559080378], [194864170628260342, -550783958299], [-1899626993486471972, -1350994689528], [750207696850194958, 749260279828], [-7863567130067955868, -3289481190008], [-7741659857551322968, 13956488457558], [-37685120255819640854, -7960756623360], [-26777361200365487168, -10682399062705], [-149550910826386326316, 8176975199294], [-307401244341104002182, -56196929456364], [-600777514402184553310, 107227390371524], [242721464047443430758, 73731528808749], [1300160238489837807736, -134713301684263], [169410789443310107340, -758127394440668], [-1843034435559963423842, 5177970943582], [2439497833646596562802, 3850265939972], [19422002051941036693648, -303555282397255], [20867067584456908677668, 504145356961168], [-2197566590934068876406, -7023184506817858], [36169238107396120528044, 1857203355827840], [-73250657398041039062986, 10099569768870443], [-12921518089561271701624, -22749640187117465], [-64653087881661574989266, -42983164725415080], [-38436703826347310611740, 80276675381126058], [-1510081830246559416024, 14079071090092104], [-341807986702052578022418, 52336642100733047], [-317035232555647047132972, -161363670765658600], [-146800262509843770778362, -14397568680389354], [583579850678315698460736, 200639333003096792], [-752513819546544310602430, 298777085114287712], [-461418434464550276043642, -95563138620390959], [1650580871578515308219416, 127985022266500557], [2009423362649812547380468, 246721550818163032], [6427642205102747941542448, -702380337978760243], [-3320468072292131623967964, 863750001399196026], [6387078365197610521754038, 392143629709601746], [-5031989244589805530440374, 2413442469371255956], [-14683375837867141640889040, 58715579419378420], [7829895368471541894444018, -3853243254467697076], [-16724833406638441497199492, -1169144414333203530], [10361324026833224377725698, -780556733114007584], [-14925008383418987622313976, 135963964645975728], [-37470165360882678428145682, -6252283144699514183], [14396411255436139484960480, 7499567272426316933], [18622116270702712852640998, 21488968747427499462], [25749183016372456954593530, 22300783472229173584], [47047413379499590410866492, 2551568568731640416], [-920295227908285964183130, -36174624255274691611], [71562695266796703443404884, -18865709009473880408], [3114875265666673709911800, 72194567695636510284], [82784656034348092072390938, 42454152608397555696], [70214981479151806878383262, 27342263165685651157], [147133075227061475088186284, 52647560903121745444], [-530561064419172375370819950, 7882490356132301344], [489908013635634351953579868, -100692659869614304130], [-414096747709972564193614674, -18574526236072832556], [-280785098247657534440026846, 269857697064712759780], [-39790646567977898475401784, -266177846818549455690], [-653706173462832199735392608, -238470494149542132757], [316109809296798817456768550, -520065405617711027124], [-1271376725832236698849623940, 207667907593857582462], [18196538728838990161461120, 637671062953963156608], [-121980186136550819208602906, 214782057135403576891], [-531564933214291341257723362, 978497346116187822972], [416798086253881714045730034, -1249164864229893538614], [3417526916073107756703862458, 253694699115673879484], [2403098489965063587410126436, 69954936882300731330], [1779534690983736913058653622, -1312824506019435420906], [1099486997942914106982797840, 748663434506769021542], [-2814450483662242021513365134, -604892755025449772808], [-789674706389932719474074040, -545520616232353806447], [-2791527903924076753930848580, -2182199978635557194738], [-5673150548419601207713772894, -341072664482011713978], [1895552369719058514781620266, -122283922964836032812], [-5634494623192251181845925874, -816039986361863289681], [449886813023252018052149792, -5016257925114968427795], [-1080614738296601009646594924, 1456813726330515580546], [-762357460015062972626875840, -933594138731299300426], [5629402500478695029251821400, -150840263168369587393], [21857219752440015042653809740, 1875671471938316087332], [2925644605688908168764795540, 2669207387905755546880], [38166781864271665615240506840, 261507450773112432158], [378963926186307752759851230, -9933545623850418659571], [-38190890731894057459901680822, 1376700883484147805762], [25214586600667606722652223500, -13197463760612305911538], [33834252770825453860562720910, 8032353816424577824470], [37101709931707922791662968612, 12517053662746321777046], [-41230287829769779852191012050, -10460620696430161314861], [-44374687420166158245543697484, 12388635260085472217870], [-48506519085073331119313165894, -31869826898142482544246], [-16897678436741856382059519588, -34737545647238649002092], [-88726098796896597248050696894, -4638936560077454002864], [-47993353784391641652225547220, 44923472678799379416252], [-42877627266439495349489083694, 53332976776705396112580], [35394202499992845131154329208, -70285346884757260427134], [-100519345333534615466093289542, -58408753480111797029656], [-270046557142954637645485110544, 12956770435324558295457], [211388158970816209509999042134, 12601812789176311828564], [-178794704625384582464403736566, -23370643074724012118968], [-5012273710960353633041747444, -15853636411858859496072], [109993178561863830562510637416, 61531599381854117056263], [119298237158010023491853659618, 67225216109945106883230], [-370320189281336839985145480444, -24193458450287698018290], [-129135927572072369312067138712, 23886695375101935514750], [377424391443372465818769341070, 100846380128483170828923], [-246964204834586424753414882828, 101006546537783989262796], [88388338812320820344284231814, 17402844234625574714056], [-320013254807753309089668565598, -170852916376628048817664], [513493842233927804271133798726, 28582063874742629933063], [-232656207407385288791900200724, -114745951477202226748222], [219253980425567239816710876404, 249117141951642808533258], [292172096451508890068056344606, -96663596084577941718523], [-1126466535830254688834280986602, 160353725694378609627506], [-392446195003213916797371689360, 91459614108377228549050], [334660014903849968021784749256, 240377133581228836979223], [587969102742295176063733393934, 95393636336059187332066], [1105569975206872676158443112388, -336242565938171458313916], [-1185143345565951360140200349912, 73000131193333493242724], [676815617753323162344096254688, -488928894097810716598985], [1367934136067047011817964834822, -535997122101734122367470], [435380678030996982873510619322, -180731885777269738003458], [1459281853162529771087376245762, -283544627445081685032936], [1018010274858393312616849755462, 816739921353168101937305], [869551837570318984415695529812, 854706411620852111117962], [3993153937120351213445505910366, -284482830430856908136197], [1265115894893815687651690711466, 1526543929214271871628974], [-1091767396218034429655809529108, 108203174454898842974730], [2633194170189993866221116796470, -1443460713505752233222695], [-1400667771556102438141171310872, 628403406509125493817267], [-1759189386765029134658838728164, -185762033371048595407060], [-1280848817041670310096511142738, 314040907964774460567358], [-4906586065338992762082931029528, 1399307501777917353830234], [-1935600499295616164700360843322, -1482160606431650666026416], [-3326819652619394219199637757094, 53408161998325355183466], [-2591369994323772617358757413924, -1902894676132687467310666], [3277519449903814831890065032672, 497030270428207959699880], [-1732564697525827015182802344834, 2860273425429049706655116], [1701169051096787011693541708210, 3501762773762959626645656], [-4406825787182548246621509246412, 2434740847403841243795250], [-3750243612680199588655929419656, -159686701362037318135072], [2727972574397769523046496339340, 1841009377974049359101646], [11536613232555237733250749220944, -1187492061975692355682212], [-7798715576546264989432907336120, 1515297658628763393441027], [24327032465921433684060521745602, -683691865610992697014446], [8497721913438556106730385518282, -87059649417038765324592], [-5030036928137679744985017298962, 5532687445490818080419191], [9598789703574685784016397177812, 6403504147958452449303544], [-4619622185429637429848488173894, 789581400358170400980354], [17809800397149171527617018365272, 3677633999179650353183633], [-15392575206083425005707368496244, -7322392362966056886915622], [-11288406413439779269063140172878, -2530361291059204628901950], [1422649541220923466119257000536, 6287153578640625274540056], [-12608856791264856379484829033776, -628483991872827842873257], [7888294435782752958122807532118, 10622588699410956803921580], [35499931026389301060576193864178, 3718262343519669211974764], [-36146031575599656569115144678698, 3981905476691732891662055], [-20255524876668779241014527240740, 13668591661213732216044860], [-2227241558928307102555914441330, -13510217174077226024628336], [-44181807808373714197632559158712, -8227935472825324895372636], [51723821534666631177908955463594, 2688003447131613588831360], [-44412201433253057866924753834432, 2450161890285449239132443], [5005009859358850258854269588474, 15225835436448942025855312], [2447304792969101349161169433148, -10025632620851582894387392], [-33168543430858029357192988015098, 8116806980720596569050651], [21800922136674325905126796695736, -17346432291678180881940255], [28492143877285662123352248446462, 10798698300055807714841272], [22411424036367859038840092958896, 7598010035480545692799119], [-34647729099835779649202458961596, 33118366403543724120223398], [-35561470560030152101196489882346, 5444364453792899402140730], [-33310950206147212852036106157846, 11077933860380306839959904], [-15306289016148149361099508002480, 18637280446033505226030528], [-30643594224439242164731324058058, -4903757041091530988287009], [54431994897532339942498193345806, 3817241919245864438985706], [27887922022133585116369206953604, -29308735837885729751219592], [120968156405668739728616514923722, -24851908369653952886496772], [36219258473048526844723805715840, 40714783179255099805126096], [-64794751372356599155956505219838, -39222308048247416143220024], [-105781942250014157069275605050196, -62865399030929563009678784], [-101719079297772447001838888848844, -25848348078049024681969872], [-164593359094148927174192634920738, -25869627536761292006264837], [98620387722762454111941905697348, 66799321195091771536876528], [129930344375125432244480500084298, 27603645119594254673614648], [-257614729883881258849865833154702, 54670547197161567803458816], [160688907356554168054578915058414, -23747409187671534504936982], [-34813759403688356717421373301950, 81647738439836212265797976], [-201479344711156224035394904942584, -16842369925464160030891244], [163656344110403657862831447365006, -21277237875117996212162425], [154230440217192369137843482983200, -25809030430375751710872755], [-62014913691022250704681404765274, -33435811764772350054891066], [-124043343122792607956076876636062, 857631399578042590997264], [-310835387606455255659096058010580, -50418325623912907359362734], [418897786564997284556997407130846, -39195314816798495236365075], [-55094911979504403314428506677872, -82042441365511767262341503], [176647084833171738543443033920260, -77561542428905988486771754], [140824209347401504957112956589930, 48779113533382717252764812], [183398825018227292121480189081100, -172148433062364712438220514], [-224400017067545362334382616627374, 16188894257810514466133720], [350926281863944059532269904281462, 26967489406860542061281591], [-77816228135405547630696991054040, 188353405502829792534019273], [-275367482091803872095362959343044, -48135577287051925534269712], [-672793684894905998925350826957880, -11204428845421876156778758], [190134792895994796047432103674954, 112324068661277747411728776], [86916886804870852075335384099104, -172765126264149885111544137], [-703273615701978603576202947304718, -222200566272500437785480194], [-730112841795559523806447421327400, 31005144455567450243721656], [-748045557306908117805206629213602, -31457028750731814993393769], [727725093632939858683937080485878, 139096551272560316251414286], [1047940520759155653643180667396232, 155197787846196831045019257], [-349275275098082824172662865329374, 464754946069193173156301410], [693311439407609004518616387505760, 189415404877239117058666613], [938748455754709196039461006636308, -285392815634772413052984050], [1429292708547705267773363432756870, 397174201924099970824493672], [-503006432402006480471789659043526, -522423411030452628521480052], [36821697998497753509814266691584, -340845245993135330804100586], [159420933513167432843947994047224, 69577045032616282315962061], [2008194398840478053787796101128716, 163205593779802583396030788], [1756865173698964851105858339500766, -56701067936939965020401074], [504055610152261849190547330169780, 692244110634750513519838662], [-1175821630910312651893787902703728, 31410380632890812876819829], [-1209229118110275928410276032776214, 485805991712913850039459416], [-802282852872909689311814609681460, -597124860044466185284711538], [130560494898539721375651192262064, 275946741123871279866155806], [-2238569031769668665692160184276910, 272319260702016669267502812], [213988615765040989382074913518966, -794608727533356712111668293], [-1945823020469971842120480562529380, 496252987281011472897731098], [1469117429904716604664804227913672, -6322114426430060142002706], [2303657729259364839720679155547764, -456284624945081278377299618], [-3262248285040960571331380792972452, -383159685053254961373092396], [-479919354909947621541826890864008, 1457097353143536539182160463], [1275845876338251204038384679651550, -1346925519875420470828169552], [-1182350775201397775288609991998382, -712133415682233121206614736], [-3170727244121946389086274995711432, -247499650300751518825048286], [-2293042877220803481201412500959408, 199646668209192460821387547], [-3150723348699423803375982816771324, -287061833511888956880930364], [-2374600648122224890550774519962484, -14060787595088720030065532], [-1288776231891246689916479339109136, 1955569748502004773177980220], [-751134266457494282755508034444882, 203343968997704148973883118], [4452933019528089636673462748588418, 489605398182125770477182276], [1587481457527112893795270427369384, -544857814926490312085568122], [1279218757686233632861472725925482, 750381204234515586469156824], [1584953790098334983598577333006638, 502060230706146281699090025], [1356858597302861831698624636996404, -429943805164876916798307644], [-2009203065225507180296234681162458, 773030902045055497801082454], [-1023844325349974942055023357214788, -89375143724315027559784428], [-1193789429039712763949283563568858, -2060726077901992302393783319], [4997082098929229280275805351312346, -576549618968029100118962168], [8236871963637492306027951084860560, -173921661465705530804019175], [10337478437529789018002229648167076, 305919255322074696768272728], [-8581591021812239532661027030965098, 321588895033595323073384430], [6417614609442606981230453154768558, 193933450043003212788206544], [-8584620672838323797401145742155198, 123704903367580081512018522], [721122194529576964266281700546308, 1693959106428126205376831740], [-3305383984895132160606519029688274, -2151888400041509422439193269], [-7144476384116681488212428263892518, -1356360705258511309631142404], [187811554937368028191601029358588, -1746736963470101055089733566], [-1240410146330435603412782492748250, -3643492804092679701755393333], [-9041349268187015102358764044971170, -1869513302746513024612598724], [5939140277394715596757538067088436, 1115904617496501815139775500], [711997776754194264294721043419834, 1655989213576556419600184448], [-1203251418221587544419944862251056, 5940824884680441093043369975], [3708210458628362817449417012945842, 1732303699914314240574500192], [11437414466135856419380229275704200, -2841615746197304791054890927], [-15371679553194065276150253501471300, 1710096590075579807615138634], [7049070267128863672019435929022414, -6704130839039626129223659180], [-3833686717158682416883288256969942, -3775533095137389488076001544], [-7264282910479512556747150406131724, 1384453984274329977459302116], [-21360382412024991668900829346753664, -362182129726595196181441290], [-2736828554113350274708769495530568, 229188421581136116003101921], [-4207053683132804788544664370642472, 1608993441973208161977379466], [-20570448723145573269846727499551690, 5751486327106392824958354604], [-1015213021634418926763323123432692, 2053624409704983742445008042], [-13155786864912747672616734948141680, -3994060602607585679948333420], [-2331763362116307881137113200123566, 7041349769364722586672057732], [-2080791555150078270006066686944458, -6163106090555905388971580145], [13201840941555029561626867495445192, -2141057265794847766366378641], [19112317266937290624472959440199458, 4922990014681419341350162852], [10775564633151364340670199970643694, -3008317287081602148509641093], [23947520693937136809005646292168212, 3280689650699017525746002528], [285122019804961254251065502037658, -4007286005914026467639057108], [-8595873722287153692960829784968788, -12735921752410600966100557120], [747261403036368986530630264450782, 14278531934791580776841634248], [-23842059604072380207093849819699170, 6195419836915270770084355087], [-29594217878703516253063919656761424, 10762271473729726819466518809], [25242696276419882047276832145094134, -11606138649426872366918450755], [-420350805933206242256472823627524, 1843423591688998795759317682], [6780102070429337803578368025907844, 3677840516005703926707223986], [19078743450380310687161955930276458, -4447190941678060663978904920], [40116754946955540817431746276544206, -10627224999170683175513662549], [1621326497020505186574353175747200, 22366332934864344641287177123], [65300095821851468002543104369733876, 2337058110570740657268790984], [-31269579759291818815976411424076644, 8778618912103609382514075514], [-47657880198484732831107842021159518, -313411146744523333221309748], [37772589391076247357019553031735660, 9061813377080554034438527478], [-21197539803157315659533889664713250, 16266516996899649724515479738], [-29160466505169330969033006357659752, -8688783535097724911396636998], [46853204236382998355710950596464502, 10411292110813098103562416212], [101753951002280716098184643240643984, 5894505259050105422446992584], [-39007569980185299249412882883384874, -4250774024472027442010839555], [-15189301912135278577741969044861310, -28038960175439732927232423418], [70251687817481029390752815982775972, 20546110269122321088618788046], [-28005681248285227471597420806721304, -1544846921235109239136310644], [44917989150078725538234863318759882, 13147901162108174154752883992], [120712281735038216928657318426438420, -8618903086616722245338191356], [-153909372744222465601601873001041568, 1441906002655642126569414594], [37786365719246729242968482479639106, -24810366225616510800255580544], [-116000118849847854786967105560568494, -12429276742813412485946088212], [-56602619353318291930295309150276492, 33288434968877317248039034616], [-4791634633262133886566288391477190, 26189629904042607665510538504], [11778851771163746596238023997948030, 18801660794915432415335728569], [80927377854859905129689070877594384, 15428308132484409891269417779], [30406461369627759741314586710186410, 31622193626886833030731602666], [96283159292074071709647121295338482, 35098633828449346040027807012], [-42457698435612914998913193530467836, -4471190007917925422650805794], [-128346097401752042494708071231817764, 11362864337160277746734671906], [-55569001631547925521539380158078560, -36933713078471483207504401744], [38837760459452585291361245794549638, -4329449504893543149140796229], [-80534925129223195338049408957260962, 26915977466722151913088338422], [-174242278431938203385612991744702018, 26752468066954360283749801919], [44870862440955811572440229960324624, 27204417474726712021153863853], [241185358053242452561474950872140068, -8516429695865048341195093508], [-90775441911651650546445811615174548, -59688728381746434649444198088], [-17754611077391100223458805481114340, 41934265090459625485694923650], [-92182802042951521357487066360843282, 7680308015484116427131220944], [24249674709000128521082168911117602, -46580267324454547021786261268], [-96826669873212267773154490575823990, 490331632371612583562698248], [-11405975794770646976915672381139840, -103820601711143365138964824671], [194424675958566622248814206489719782, 9792160625941784036247235008], [246906093256732651263626153314943610, 23658086042171950281620292058], [53907281131922235156944865357475590, -78980094932657874326349487787], [42310894025772756784287781914007128, -38861657278061357200114187603], [193144914687696545772063303679334398, 3019758893531554180887139045], [278487182543744090167121164524165412, -41859204846128504475997598154], [-162264565743344888420545090316178186, -50261437775131860927703695502], [-124417169727349079785222894354503284, -35141418821918279642707140796], [-63076023583222618523239479013016112, 51323067360451275311512270826], [-60000872121244195590228888695321674, 53584719525689682872064059617], [133643856761515227040568632881431556, -87082599372794158282797968622], [-139017018977374380108159262068513622, -92561825328166712287573499068], [-406714443838552073479620708533205266, -44897400335850620384925157019], [-121119009002884081702361407188540192, -65171085025040765861888655039], [-310641155982172742640477271247816506, -10441637203173434457009350320], [412207326762771579808880810807334074, -40827468812163126768291834664], [-392171717640929682136298989275216608, 29704734600301389159662829084], [-446181486511293993302073229231198900, 41745823838896743512102231996], [60032052115623092640059323439613970, 56580563181351324570782999846], [127989618041256523008984938138797752, -145016866825806595930313895484], [-235117019605524753494989887995285578, 111992268681459948315313840256], [154541107268662981961250616548992106, 72606017067414632641360306708], [-437639408370812089297152551749006320, -11545751782684507321870766184], [-152543421354740028269100807640745764, -192833787435230934299581620622], [-213436251707035625146495356073859708, 137478955593709051664175087028], [111369190783969573590677828866237770, -142221785807229320110285980408], [-46406261570018372110384229453894514, -230642658966869048407394047967], [171229306313419981265628651407510392, 67935308673026118671513216579], [139182831640054016087209544585004346, 145713531622007611315060057904], [66739277281596850594859495166997412, 47411727893756624226493911858], [-228222717593080616249165525723055636, -110780402737049827526275393682], [-204011183614906778184819155941114768, -63943071729452419474968089192], [275704283455383766428351214378196278, -72869464816038834234108008211], [71234604826957457297407301757761512, 87087278310546004310919802167], [309579080479186649769951839219634350, 82998913148232832503809723986], [-917084379040976599761640734112287852, 22347671743641308238532120814], [-397405933798588980960106643252034144, -76041640046617378128781670344], [451465307264363123272048260123784354, 136185309610563961418388431232], [-631177673407321711159900909774541166, -83365879221796683170032362126], [-236481968449538298976490176517820070, 46857081847780143715534094820], [815982784789347400755339868482298686, -64759315545970990108493162049], [-1009892174431023997669514041327967926, 20668441991082319565734241134], [399666595995601183082202098788782408, -332719683003556407480305165529], [-591173519695821945921335821750461726, 210672369217326406048039971152], [-82494724685414736466211019444486812, -262289487435473117728431474986], [148032254694634901447782455241994088, -10827196653852623614616420656], [-486939331155545362541974469780452512, 165296512054406815995934544775], [-440645722212315957401407624066709818, -114382299332727045854659004874], [-798332959147369467930383763020800868, 88415471569566093111602703072], [-223271713231480640393807813560764192, -517808002058984044680352013226], [-1202031127056585395680317112762223870, -218769894592925421611702767544], [70357107942322131950964597321916198, -163993551915411525907208869809], [576963051509697839959428487753770924, 100354856509887713899315232336], [483919519590960423059521932807481236, 418656486644689190866035422390], [1648059940058937503093650453682871768, 161852129720866934760392410916], [-625419577838409793994552425171190726, 117125367873924077213037215044], [-812980031809762075660593813271997904, 209972362234374363474567374289], [-115074422184898641165856122710441238, 28284231540672139675022725674], [-1652666902909538379503282482509644884, -24726221944081212921327147746], [-97324513028277685157786532764112170, -400020283566240352391624710373], [711805198058709557598128116049263118, 291772464993989888761872757340], [-306773053938090725500383400317632286, -89785427617528624446406857062], [-296393644602150466370035202237981984, 36134482163764261388248701385], [-1856267618315487173926853459872410790, 65161284337525403437089880914], [-536051847799462807613486651786823578, 496856138146565123492948167877], [374703932376273538421805097564964248, -489508141986337649647926534349], [349544281791283141353673519448819230, 322366495735231276273118819694], [-325268846147284338000805219713572910, 673530256152300126321963054634], [-333504903005012381675007037436786572, -71332245572812991097508004354], [1736273909699530554534623909101058820, 359041123440134882360297226134], [-1678429779184872709441066716270811054, -477490641755258286758522833776], [2211750741512092553900196053210598646, -163191276385288801029762933601], [-469474381998166667311250306735187172, -1066159272177752182591670576898], [1251655251586457224125957122910933988, 216392946890231687260109478802], [-2584759089782373913605450333729215286, 59633651733635170954765200104], [2625463555477241560483335930695888782, 355760946824214020590149607193], [-726171810469705234161201282199867968, -179417994511506630651422353336], [284275458245211739147763405974347128, -733412387216632793859416627061], [-600011105968731870948736636592926158, -144602673394655295158188430446], [312726549785545098494064600162330872, -44484381777066419939167787718], [-980947246999839991651804589281874722, -310062688196567807201106398065], [1351799716824311523428781464779500950, -366930367882536857998695226904], [-2719162169692542200566537069579157584, 442642576190194190879948270036], [-1088312094675056114855595133762982212, 455800045735388250904744380754], [-1333938736289103009396955286873064662, 852242967203571135325316294152], [-2143931205183042262853282119554646930, -751183560445073398567549633047], [-2291232053753605184922603706441264556, -717236515136600902103121791678], [-558771618860455472316941163969590982, 591884944460689380871513330540], [1912763201572340234195827776113634204, -1077758124428846941079409493106], [459141923043122058040118048762091160, -1251367689943266105713523800082]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_24_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_24_22_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_24_22_a_a(:prec:=2)
    chi := MakeCharacter_24_a();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 22));
    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_24_22_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_24_22_a_a( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_24_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,22,sign)));
    Vf := Kernel([<5,R![-98034943473500, -21948620, 1]>],Snew);
    return Vf;
end function;