
// Make newform 24.22.a.c in Magma, downloaded from the LMFDB on 24 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_c();".
// 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_c();".
// 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 := [-828958533, -2295485, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0], [-587703424, 177408, 384], [20563082624, 13402368, -13440]];
    Rf_basisdens := [1, 19, 19];
    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, 0], [-59049, 0, 0], [693342, 1, 0], [-401760688, 0, -1], [4613082500, -1186, 160], [239618517230, -7159, 161], [711729947682, -194532, -7450], [-13374108228996, -693676, -1702], [92808139227544, 2178680, -256122], [147569389330598, 33914689, -1261598], [2672023387663384, -110688876, -256009], [9243113796245686, 533019825, 38087851], [-41882708395446854, -55942192, -87729802], [-76350847166358204, 4268277728, -33793878], [-149537927356015904, -9105142268, -8794698], [468735405736089022, -65755502875, -42375918], [-614879660490540700, -30558827052, 5713027140], [-1098022100116783794, 122799957973, -2717730677], [-11163674564385006884, -339564264364, 16493691972], [-26477006143866293720, -132561089748, -25542856470], [-15537607635652773206, -942963337786, 23538904402], [-65973324568220366008, 2005927094220, -27642550565], [37282842850628980092, 3811697810658, 251590170452], [-243669391946747827686, -4152851834800, -149674305092], [-531507306685042064574, -12488719178940, 432471338728], [240510060958736309742, 27595052361081, 708185841030], [-796967262442560678208, 44565040776336, 576062780257], [-1183935144922769813612, -50276002889700, -547666461416], [1420000142662601788590, 12784234599057, -1693649157883], [1797067705764137773586, -89976300027692, 1293724995928], [-579405739132712534488, 87295502524676, -6049337460067], [-2989136837213963982244, 355926086271368, 2256947164328], [12365073517095024529274, -479773700368960, -9959686783086], [-7956167756512800271916, -869572886306060, -39065970355620], [718112955136394116782, -635609007846999, -32193550981048], [-22071129948815316795584, -160276251455824, 87959003194143], [51704030858209491514126, 4549306051314833, -61767561498341], [-295916410050005578048308, -476248079258376, -20776751680542], [-231634782586154355544680, 1020038164979112, -10827145109376], [55102905821038778383046, -742505804719271, 435158335803436], [-514511957361425123328532, 4242194839395484, 124560934377772], [-33044967505728732423466, 1032446366878121, -994546745628459], [204616714292192998256768, 1684527751293660, -823687219292884], [216641331142909051006338, -5534486330325894, 1695863787573262], [1215026546344040931661486, -23632743040597347, -533474700892754], [233377550654588330700928, 27776815582744376, -1382651016336851], [-1445627897710716070757940, 72888879551990636, -939183295086756], [-740608408115526475856920, 10858781014093220, 4927721812266929], [2937304388702283732866508, -9807552366636634, -2604037284559940], [-4877709833976198345930906, -11097276832489031, -2276141652140375], [4542487349017279925073258, 76238799094822940, 1840233229027232], [4691288692128267015980720, 80328584729051708, -3442875302154616], [-11301880202499491086697198, -32755568156871418, 7988454504793958], [-954208517168713216554092, 502526717731913038, 10879850479841744], [-6940246685394933371506174, -397528328064689088, 26533579632554848], [9595157430582669990643448, -33101369842596572, -23233389620630500], [-26550805131440350289696170, -423233902246369435, -18376493331633634], [-16629841596032253543201672, 145382152977601596, 9332397861139057], [-22796117946541064246802890, 1009337804090033049, 13758639661457781], [18214907115202323044257274, -485057425933978252, 30935877133823756], [9978819152975567368499652, -390134441166736416, 28204201462647424], [46676895091660627441165166, 2147449379820997461, -60686885450262814], [19089799248927413309035244, 623981864732952228, 113451153899166548], [30578145478037942722828584, 177316829038535380, 146342563639596392], [107150279323737444017056986, -3528603401175297550, -66307643908332698], [-71719643435886439414522394, 652710084028638997, -371933810875632270], [-107880340104875343103599692, -3050090495812559996, -338393856956772656], [168819946499671566133279826, 7615298523155015318, -47528089746723678], [-334723576218019141751987468, -8116323212269105614, 219515572827513988], [119571646154238759224034030, 4878075914722555261, -824717728294042045], [-377593943753474793101925694, -6888309115655981708, 176821599025229016], [-444812208567871906997622264, -4507172449843026068, 35374764689854346], [-120296331562097004402930040, 22979635897540241348, 800284580374416575], [1023488340843484200866896934, -4602517246075479171, 420485419619588619], [955103971271765331912621332, -260002197269012132, -764876085482383870], [145140403289898480635354112, 13156465425276738204, 1670403125185419348], [-410936869951636873199321250, 27037827564708846229, 1990487927253945660], [1006850473454531585566215710, 70478882366064872225, -2644519536463821881], [-463729833191672706583518270, 21967782194953950356, -2513395070404169054], [1566811133490209271827603482, -64350998204302555940, -417176832088633608], [3022648667513844998266274636, 47156474648785033662, 2940634028770239116], [-840666812945802580978633594, 11292639162612615025, 3314335752876374957], [1414421820750981440761265472, -37021101141118185932, -6014882903524227950], [1362350229398615905039574962, 85374730664964961236, -2627090094144619068], [2159812679983611792408725808, 83036216491740251584, 4760831727278172521], [428297293379702515879922708, -10620681730920048166, -5352558936277115764], [-5040413340838160782709010862, 48998615564124288956, 5972908410074949694], [-1480879153344620302099264694, 122205907341891922212, -4404277098866942728], [-3022265248895826550758569050, 204326850339891265713, 10847816463401354556], [-7202938052405672635404268552, -14125985488332466292, -4665583859517549751], [-1622679198691233618356040932, 426192076374695432350, -6259198306745490708], [11430685718633176203012063504, 150377334735959216840, 15439179169920458142], [-22072539598723044384780795472, 55441021574159806360, 7412810427305948079], [93232435526958470599252372, -127271833113287509096, -413675098396628212], [-14966619188910964663151235220, -78316110356495344816, 4051244118478688112], [16419862061479651891518258872, -49799123220374806484, -23206500505486313486], [-4639642379613704524714176666, -555518345974743721871, 15704999867761222094], [17542226172366833988440494810, -417122991538202098500, -22715611763905747614], [-4403027347315285148988655612, 437621438962250867924, 28827319819671471866], [-18295518931507482332629646370, 132761625599586152805, 21865086625563838665], [-12674923334979083741963067348, 1418439501244720878928, -4948032305737181514], [-51889703694777658298789618074, 2207016811537327593189, 18220847510180149140], [24184420221950554344357903004, 1577296025079808513366, -68896647752025312512], [-23649273186536261243523226870, -309624532658723013608, 61819521781235511278], [-63097438255144118395114714940, 1174148280908076116824, -79030430330027443524], [38883134152959819913846660098, -3192004803434560784142, -46503146868517579514], [35907119198566209546218892788, -3847010626871190227040, -31900174863236258436], [-27053841796851507007835157646, -4093409480723113776812, -119261881664041803496], [59886134009723249217907445624, -943370039578341849168, -67578203373576224446], [4765957717369588905354655802, 1967782022786074853850, 43100017998192620902], [19202637346899971477317355912, -921211867826411973524, -267908435357368418563], [-160414634713151509646434112618, 1844109503450204736501, -75534652830474885589], [25923637108708413565674971594, 398762867282662187484, 286746426272237533196], [133959312190054751153898166324, -1638124242906364026128, -103598732312970321400], [155665535926477900504104640864, -12472017720638669251304, -144642424726393129033], [174007681177638212625420966098, 5412948329536674527872, -297168492044747847694], [279103358089611954298504674444, 6927252842273980067248, 96874673377963946894], [163502296477742835900092152232, 2820021812165177811432, -76572182052498581114], [-67759072778207197276935348858, -6674143714743427554695, -225163253362089138904], [-279811658552878917565622623572, 4217787153851993889144, -244689421911855006060], [-63291598290852271680864649370, -9440189062601548429787, 531048981311630277607], [462673833511367842417830009122, 3757969637077388846908, -322365344801797937484], [101263661205105362232176649886, 6859750161461170199209, -72557199143336467892], [-428065671424384894431278968124, 2756225519783800247630, 167324447919421023036], [-725540973870071958227210743108, 2539346332457492681104, 371498285770182651146], [-277107517811013456702889496602, -9499490377306553941187, 724583430081476320570], [-794183250868463890751495134266, 177374641104809552705, -930634675255933454047], [41483134654011343168370316480, 675295639854037291144, 768993992594336545602], [221185355278989876558877493376, 40916324686064582328528, 204433624177545845295], [-985301371385556045336320424770, 17777394068108475182045, 621329742123302785797], [23842478373977061707893859612, -26378022011889731823912, 2185560540813247550316], [-285318202240463914751008190792, 53834701991176867670376, 37184571147250120316], [-455500433964671425380143219992, -584427499168270794180, -1793373606168749259565], [-1657818292159717281002582445642, -6444826393697227275895, -712165108525375845415], [688055422953034062566550149674, -27556517158177023270532, -1290568978304531169530], [1642862613537238291654991652866, 23958199633731308387498, 3097283914624186324006], [224363595402357612890123706158, -61956814377801786606935, 1631640611156121202570], [572097447394067603842731547356, -107352803502135580501020, -408576733606391974906], [2066912616173673067574833842646, -84681607098222440227, -1640057625898648674540], [572877722903571617361207331610, -34926589688393201413776, -3858096534729889822286], [2853193483465613233734835172932, 76850850960978353900668, -546241461477541053106], [-2141500895495448677053172281570, -72758307289936832495471, 3701781039944714979202], [281344528022763556048567863680, 155310214891980458059696, 3177910602555622981067], [9972032868302089989187162884, 180127512333074139761076, 2378637227416951994408], [-99079573611975689881935692610, -139415786350938576942383, 4060635193633261864165], [-1272771232258521272311805735224, 19959546329311679982812, -4672592190797829984162], [-688243422208670409053622227482, -71693297058887273033155, 11415940173092413664743], [-3076962056559248405789187782742, 195252746411681848963064, 6064040296097662772014], [1569240468271287154249698439540, -30532622899167784321080, 2700330344956557307582], [-4146714446292922443025999626912, 76238566129845168899492, 4579348051459931253716], [845170379812477259450396895358, -256799111940435426216707, -5828574739947226303029], [1895091144933897121348969423986, -8385933625385271003920, -1071265598545203600392], [29550237833090212612456817212, 91135886478417275922368, -921310233361160571006], [3932914317406300490148974552328, 83810913972392843927716, 6698964302916634772044], [-4772648646918656482843004797436, 159083323294477008768064, -6896592279761466881026], [-1243000332897099565007038506928, -65737971294353068764996, 11160990088320751632816], [5378624508887530606656793470112, 324722411382536001591512, 9512094862668701795347], [-4774145784138912568421890421294, -81134886266559062177596, -13866028597705983242006], [-789218137896164062396217909430, 310616693261674131796560, 10199839534971569835936], [14389154444441682301374061294534, -352591387153891598988031, -2636253447225497714140], [4915921917381337406172268383724, -525220741790095681126804, 13152115476333189801596], [-3906668815591726105350502628790, -469606456341042772146036, 16223581043295022684050], [6101897025556631276663781323040, -671437190917272742452392, -10611979886090435811855], [18222095649760467925790360860004, 273599934681293241585662, 15250401075308358507300], [-28870843956438733394541069091262, 566229647130958462494516, -1885812590646070379702], [-7164203892032712733881818575512, -273482063997037148576700, -17275962026676464106588], [-18628948764544273368501914182408, 2680679535909409916116, -3021831504265122670533], [-7997766298346683355760373646378, -703856595289644794054175, -43310827472381745282345], [-17722606409148537698188708059438, -635752864994995868194484, 32715419547427043682840], [-17157123962083422010063361505362, -757432041238311266792979, 41178567594896046080888], [-3467527483978227087399769578940, -1219524216027394799570704, -37464561936891884814612], [-14610807554549138986753305194706, -1086076449993683270575159, -10091182116276652488245], [7696225453944667173524870922392, -396488255157526717391712, -23980926688750031347484], [-41518853311762971572478954943574, -163798290679486663061184, 32252585526253384385088], [-12878447831171305728090172762264, 300851090790531209944116, 72786907157427694588287], [-33969474049601595325928736030214, 303014459896956991041084, -28996951917695250012572], [16730271485588992000861579393476, 834030253852387723356016, -12957863254966117917168], [45786482627237542171727666391038, 21555460805403453683273, -27830109749716300225608], [11418221834997156248608311736384, -2013119216212285442728672, 33929142535050354045529], [53215879357867254757843177662814, 815581550175086945336493, 27256156350364432267535], [-59798642116430258631963477793960, -923137044930769802109564, -54924268831128566546109], [79603057194029700657585943357132, -233543009853421488781398, 21914237126642435064660], [6220593852841728908263342913926, -43886057637120981772107, -84964971036261415226891], [-56646977549241835205805745949078, -1339758853226039382379596, 17362528791759044408380], [55734324709023111455002680271152, 2274410845862603503808420, -96539546247671789431124], [49540423099727088813182638528718, 2641721123465261051074909, 68082329823507960148240], [-23806821626874312589150124362242, -987659511223628168633331, 15894847716261368531789], [-40996684532305621524082973576772, 173695954836411937661024, 154807003362071520197848], [3996745082570278031934532593770, 2568000612626570626582894, -110668369622925271472274], [-130774448986003643774879399969024, 1300711737029758064821208, -29111495899106260691368], [49035341402260179486795381014082, -3244837974129234157784232, -181595334461790038185984], [-74736102301457086234668499370540, -2812432593228456774689084, -21059667549035415685620], [-54353586912040014089658220948916, -2632848902479229221091792, -300419675795204438101312], [34563201947962838936244698833110, -310428386282439922800703, 77901148347739265169920], [-109057043362084283384825960715716, -2869696367816198900192224, 51427722370656568512464], [38206427148184425005808319897994, 5452953069630157166110444, -117303442098587917552692], [12900868356519276955750827620274, -851566489106736116970094, 293639380524085499943606], [-138013279351785341046349730654242, 493354878781497678563117, -376168054245790322691283], [43807271656398268491109057570434, 7106354234576641882814500, -132697280095110508460588], [56224709681253085251320332164568, 3936121673976022464039156, -135338668973912990266160], [-169310838768038050952621787749274, -169701490481981185581483, -184661747426162275822384], [362364268605169096257960399180280, 551773283016691750049308, 9069276140744808984409], [99829699027701486090364940638070, -9591588936299858810130611, 117248883633585376199825], [-40939762930646766274809015600478, 1223054585533007524043838, -330776699227474435536854], [-106700193595944771105278210058364, -1477855284490139911613486, -476051228558969504873000], [-62824520554728303222887358071706, 15527206915733832441988993, -41968022881713504522466], [191532216117430797990258214918120, 372157099883471633570380, -112919598474840569168579], [244912189156681345781269275548684, 4172697797951034099087630, 487330484244482633264432], [365838627531035844766299037750602, -5812207602458195705072820, -255473263471534960199944], [-133716342188675942801493369024764, -4972316860244829747158752, -180059839881823043302418], [-23631875714174109413900052833966, 10398995214280517802809450, 571522099116824396195750], [28826763600844290265043645715278, 8384622847724658721195217, -593013304024685827951596], [174698614957817376325260546709392, -2339550368085598013785656, 77991530863206437351033], [27820869536929922189138007634116, 18093295680396576957107124, -354358175878456277480692], [-173287114496132487979435322145048, 6112600966508241347350804, 214569610996584416186278], [-49551013141456344175825520933110, 6327474714520415405133140, -185176392665288758450892], [-117536588677972378617201884991832, -20436165918476526762931828, -784235334331527817932413], [-376071112896368882138687019194142, 8988924528440577983415744, -914847381361017203336750], [-500333776071780124816018287048856, 14649513744249815458195464, -153174352015591422774256], [157468728627449192910802837457846, 18226873723528352989241317, 615661392755109456091888], [-666469818317488027332714143945466, -21579453282437843868198971, 98382364742416288819185], [-383844670934275616317848572075856, -44144890493217368927208536, 1209509578590150436029833], [710924940344898131967781842599986, 10926884581779351152506752, 457951716066018359939086], [-695500767184395194055090610683528, 4279794698862251309057628, -1376256201420291252820415], [658440321829691473049234746694332, -41881202068919964867650750, -972641644725353057675580], [77430691936361398740993661739622, -43785820878599203184649947, -443027086224297790345785], [1778120357196527682123422403221658, -28325532338796572726564808, -593665729949466320454468], [-296990068486350524135928656024752, -12771506712733265176995104, 503784464515927098038470], [900943102765944028281395724498080, 17263020905896751710393904, 756074499287130164975829], [254574782764339616403117382673364, 5676690692441058056708512, 2569108025445214983166020], [1138386248360056971636415962280558, 15411457284718292130603785, 104654229945565876307837], [-398287053827992833061448455431908, 45123708552234772340913224, -605044040221554617158322], [19736241470677130731651912642376, -18944046402336458572507532, -1113386245460637060584119], [-1369232450796549961463865440918998, -10665839124819844970384100, 34039510527813180275388], [-404392380527258138767424907023932, -23957099977549981257957248, -3752779876219298903712770], [639016789730877525703932608248160, 16359449938373843019640000, 1298361886370486788991022], [1673794338204471332665175426739122, -42265226788876647393507996, -82349606999101394773392], [-1178238169777872350978435948952978, -27609298292160233598971719, -4104364067984024278299928], [1993768711746212109241577117299028, 15944054380804819219495598, -1929452928014396967832972], [-203595956485331750177963054644024, -27996438169254657748828224, 411455157903051045185790], [767368952765960603642337912142684, 49902996066399472800943174, 3185436015993377699722656], [-24019111662007334854033983073148, -34455959773616499668162572, 1621508772940016895385296], [1116817509082020270364487076129040, -81660502013027160849995440, -2461744818871645912659929], [-1579969540332315148563056547483522, 9708394595307101143416433, -3555915304272727221102557], [149113463295701073673244802169938, 61328632790371546208182420, 5220053625759182698981388], [-2095269238502530082292436889174728, -6586187885179936938384060, -389147335190714704976738], [1005556479347728803723179896218456, -67080197448503803086537572, -3475597071874719730657097], [270229687199022067559847683454812, -5457927509731199589081276, -2262325910668549512314320], [3857496483970350323619820617684, 5591753351494305010568260, 1440572370677845214946544], [1244280992663227985193559996162096, 32536942306865591629832248, -911141669903968840732156], [1295278528742128634389153473855294, 143296508308798289704987921, -2822315037977111409772171], [-2473760069303107065892328024727006, -18176524311513738034621452, -299018216758675284158088], [3211985843940772486829758275958568, -47029211665034263053054792, 3342676789766904123095230], [-970006237003907214004042573277654, 96371599438854548838957000, -3576541063302744188862528], [991078623819086698514269977833622, -21581928715694649111859551, 1786348402896985451087202], [-1929835596939518517988170928893140, 56842311350886163906890532, -5955414147180567007331376], [4394696676606155906971160336297846, -66349272967246460367018147, -4239904748647865617359], [-2645835794030786080161229721655644, -45102896373524778288829800, -1749041735828504596940676], [-433030297376730535620952975828978, 177050422793605689185545277, 518725822087853297399478], [-2185346544649991799287379489885798, -84182312822182814715804532, -3277773367206781243702692], [2495961331525545677173689020753960, 98640789116541810071101324, -748375978134154505034603], [1186450611090842197863073583213596, 190256920154928642178223388, -2724780772351423540826900], [863880119979925581097865664009382, -192682247328761257867947675, -4387158952740206534807055], [5075971170328815040379524968249678, 128152493612740153641796161, 8227221591213495974905971], [-404982120367797604449883500239854, -14238798210754612830383128, -3186647118801239060836850], [-3940127445080076802879140987553892, -68210128254042060403776908, -3322900007777635290720584], [8725107960876947058248315575690022, -270731914221898772175045691, -1570874346223991974010500], [-9341161584100664628576608284198342, 80046470782827623124219204, -3895973269443265086006800], [-3301986216823630984663008346966412, 228253442147562092199580756, 1524851369878800477808846], [10591411761113865776354388611347358, 106438034242931740524936953, -9304340589546703361439592], [-4409725704568059227457114198937634, -30893371642801748729923179, 3701279559212964365388771], [-14779847595145201412708991277087636, -1523795825887015745847064, -3126757609605805742490332], [-3385024504881041424343922997870662, 238768416990391659080536072, 7693825150260525411072152], [-1869532337075396444889449410010376, 81799188786591433665534772, 4922707333062276001916731], [-8245716285747831155824337313600334, 420059124315653491427014896, 5016822812554301756244592], [2131202744719193696329225555822832, 300120872749672574266332856, -24894175732856693849825071], [5103165501912582726180087100189236, -12537402291195403036630222, -3225128651505728076596048], [1739264158686684597123793650908814, 506189362774368816191504513, 9593693351132217378244559], [-12815123079836766850990288712548566, 293677019033725038365497394, 6067666573559659122759390], [-11436484258490738922546521510328468, 147181338999358621024554740, -16437332863470354636901792], [21190384267640154353567508067680464, 144331740270134773203502816, 548036641748516792676518], [2274124195294763892681796508867648, -311637644501489722175447272, -5122168858110703853870143], [-13513626585409456573843162680834344, -425975526322395062940834808, 25447785198513932509219218], [-6297931653708263643516887345469386, 83282512837354593594451285, -33057181781791126931318093], [-6731610444488268140954030943858140, -251118130060392801077265276, -39182276808537025280872954], [-11950162269700929495215822989162800, -52320436454228958573100152, -5592230064604965982738676], [12271368170924123807882573562806834, -387427297954656022083278026, 14532261437247809202244606], [-7000036293731413827898443680826162, 150692986499335640905340681, 3536759490312439598511268], [22035029556995337187382002450940096, 269241851037090789960469432, -6478365734712827294417857], [-11889178714198050162032419532972350, -426224820994095958641658668, 4662538497001613814070072], [-24851809553185800979909949499518234, 836262742654714531508981825, 11620385786117560661076096], [-15062154590701316182617444548124820, -184617809869256589181249564, -970329141763663438650996], [19890743960070870182805586658605050, -884890245798374297819148704, -12250112504714394525638508], [14524475944270185361910923053991892, -1062858343058490906969218404, -4960223463866271324204012], [23203206745116935435405715485744830, 54358395796464309153682701, 9342085427765618515778719], [6050891201857345580550555017897142, -480802649837273860037153247, 11343767164720108510712620], [-12268026786224632824483080213495800, -1364317471400426120181545660, 5308128047229126155912957], [-19575258914041492099739575436122114, -1099482311674516776246426079, 25962299313027070449382638], [-4474948202896094227420844246419532, 1912588806964818646802055442, -8977067338575723822353928], [-40064863780722088056965907865911700, -195852496515474384708752028, -5458474278793463849266962], [40685558674889185290973357998651882, 577862982244090824013210722, 15581116768402632761479486], [-19893280993146627815609072900718522, -127788499043326197940959583, -14413710169362021157924752], [5574639009898291930764540705371368, -1764731830872766195195449500, -5334456517006397812588841], [62888991380115980889388731790803660, 8618644509305188576810896, 6916726072242381107822776], [-29052554352270599283690937158287980, 1716869609623684020766541888, 36010501656378000727888266], [27366629811154011160063648833732546, 117366183569474271633437806, 25437416340059491188663582], [27477491005798124353577509886024612, -2035532224198268109389672186, -10412397236012463710215112], [-26189273070515221502342209382741682, -670791990899269804893333331, 12264494886305267930669021], [-6288408461876546305197437709517800, -1054658447828939319814476596, -78078581404962369941537522], [71247206598460768208339311259303606, 566959753147848065326631301, -41598615752549404814548773], [18426026936319058488914118245823152, 287939592287406641684904020, 122490551407931731216690308], [-14989218280744222458646561163589154, 240809542154199471927698113, -35565701146554833215555826], [-39236553595777709153852813794552398, -1419892881790267961849410424, 48327240765289277082841954], [28897363144996785453789692678186092, 189625427863964998657121884, -59807274764976872506033966], [-19251328028912099279804069687423432, -2750577048415457460224377188, 69699787993523713896677888], [36175603079669359405347404631273354, -33355547549978855439907992, -37733899260107356637351840], [58789662370987409192031036093888204, 298013884071588494843844656, 10256805117817651765557940], [51429416287751282463697929568903056, -608459583100894062034145736, 37214314699003202256972954], [20080319870862334756749461715251458, 38828488607846212515345030, 18929609449760692147418642], [15620029686702981702430849263219634, -1509251181862749468660221032, -26949708454749810184935172], [-145734459960133128895835707694198836, -647625657708051362709328160, 20462398473990931414989528], [21864717178077030569971475417843386, 543657863966985989492136450, -69936539902727281605386562], [-98287489017721144926948710115619226, -243034234923061053628969983, 26642197724346996140699058], [29127284661348791242046249532685272, 356594443949926742068075556, -45968722022224508881700889], [21157935314529400635162754734636794, -1391736921237545760136840096, 53101073397360502424870374], [-100677901812768614310428384618071406, -1686358732314277173488097492, 103361274733374124529642560], [-58127671124560416733625668039847540, -2996375445606016628852008412, 126902657722760377731192762], [79632178734598732394157874185861908, -3545332715912629613519638288, -129319399973924276274445182], [-57866712364517995636890898219486496, 872869742939160880221690640, 30455932807360113565810912], [-19849720805943479158096740877044994, 1828616113019359440859121325, 182374896032914616116588292], [-115346615703281344425103319642494930, 3494521763319869900459493705, -3030050772309354605167019], [81041681296644175942958000764532054, -791974425362178617652424211, -60439928940529406816933600], [79133315867529460308635271542966792, 4992177799411644902642834860, -204060932466669264375398231], [2650626154093122364040304897175420, 5379088536173626453959649668, -143075689249841750488498712], [525085105211106833657401214113364, -5461944245482162460029881628, -22386153220275866918480988], [-34991758631510333866001708090627820, 1624561023246290496072009074, -121686801380853818857099928], [-52778838376147553668760276515312498, -3529235271192766976642652943, -81372523162711591131191677], [157721006585459249959287742499325826, 2949024422420055087705880440, -128194587449997535808070116], [-115769870365893582638275748778922102, -1668445146828600117671622130, 87105245776976187818546914], [157887522196862804651360628079760376, 777554220219008850094284524, -152108542286792930140087235], [281801308507887213032505937788102790, 1590615308329120819732798613, -116350920701664698295904385], [-159383649768677064311213132322424118, 684387943934274012245567644, 135384077537028201760087338], [276544103954999214614860155179933518, -3051199416684865786790975379, -5459005412926824280044998], [20827002220423381063489075865760320, 248045444623186307374908656, -236713889402849240703733131], [103782058372842616646246758445787462, -7667827060496620270405860463, -141192479847720135900192874], [-30372421313168707094101655156598292, -3805396255680071002679865850, 411112930669791184242562168], [202778075054468877465401420016164902, -1320598573914093318706239331, 33356839444523436614604341], [-24706724202874691627037463821825580, -7432311099116490447221403604, -73479220643657129793466264], [-197894255612339430525854769730602016, 4832625815806208211199103112, 81457043838286795094530034], [67026457864365337767727460302793822, 3017564846162245308302344589, -61604709129461603508539794], [-148321349196188787140466970514100756, -3097876364357180628012243900, -144215625830788569422938386], [116381429920856977287468194174457930, -1981551975517063440471849012, 139399843424306737212729088], [136872082047012507429296015007050550, 7917344832483536433291735305, -157461491279878037914236802], [135159057816767645869352868067934616, -3253546055093514977657263420, -21362421264899876223044123], [10508381314936647040942174932742374, 65652710463337270473518093, -224073196599420471457986601], [124901908132265255229585870883556730, 5892670043779845371823283216, -177511321400723922257225960], [-100081531493405899649058574910583424, 10345362698423036625844830268, -18835264557540703416071824], [-251448784828437975719587865374566444, 89305664738830526908086968, -344533525371199613983676988], [56570838298926933985892004822903874, -12570041833359581235108970968, 274534984381105428468899618], [-355574222244376145338719247383628888, 6625333608239856359532521348, 154688743730779204265620656], [-140679049103325511715086247747391018, 7598632661295059805999351409, 507417375894411678057141459], [-299816758413402532572030263644294646, -4923962331804058461741391672, 241986056491239772166043428], [-949580781385205446938531192680016, 4433712592327771911446543604, 349469542418082588779848884], [5333878124638744344403646112316884, -6292236880799922528642263566, 499008986281944673482787416], [-253412985399692334804874711604949540, -8715286898198068930910153112, -272136181753126365845287540], [-211867534748117242981804273229484342, 6960460912220966445523200474, -199917431469674829452279994], [20448608361369550626293067257562166, -5480389177080076048014469195, -189721033718756960966651674], [43194837953182280325424465387919984, 3105811070539164439295728000, 135849330321977240145904203], [-63196988343438070065403550632249030, 9217987439887649315332181172, 643540529986067857073040748], [27356026111577650151985645614952460, 6339285179977641845977919946, 412537027202005976328227232], [241777781469552160221597934031115812, -3487163635089527736511819028, 102835197519652997419696930], [675928643510274798529685702803847120, -23895408883081544762988984, -410313765497987941064294096], [-321213266649139742982166584110342338, 1566242310833154664358851477, -1011774289017259074010202662], [-455611554174333588314366762177725856, -15515229627468633765382578112, -24804050403074963860185185], [-288922368945657840183248964802880546, -7304799589564103400340329723, -1259124511177462253586965107], [201149621587318161084515882295950012, 1486158307514150534280928142, 820709481620849028550268808], [405072876571823090622549046962785312, -4282384110856890382243396100, -642371195380192138456810772], [226052116071197720517740448207626914, -16124386520051338625629318384, 679848458988653760692712112], [528615686268334578233517366202344738, 10006038885372706879598663560, -686235731552520716978524138], [-699872160995452385545379075526472390, -4279474926321564452103202698, -690465222576016241093525154], [114591670784245091107119758414692182, 18229668129357112833979234353, 113116305370037043460764972], [603246365292627507308292314268408122, 18175148436530807834577990804, 367969743679809025126749790], [-562676089905009453205469655292927104, 6481755909910770114053725072, 855932319921984783333515903], [-697125534586728751142604054713155486, 14132485505849339098588196888, 19264066142431936437370488], [-732820905953967881543178091475035668, -2275497164241460511368329952, 10132344211968691413792486], [-942328999615682193540955371307038952, 1952220954259320825327208840, 733830810788577780341360488], [294597033337086601642891797811502568, -20883765296657881429970742164, 423324290855286743305678643], [-584543910701783536763795736712626538, -8203288429029040999316804175, 188896463393059074963120717], [-247628884309340632018826670289002524, -8269332725160923524793063556, 1484203734101620187259670356], [1124385762874317728185592943861270768, -923246132515863640829223676, 615010753059132457394050930], [446018417043719436086491301507888706, 34077823236371441981202554888, -689825808891230568773309808], [-394487332805817937447665068138889154, 12351880066208632339635503157, 411960368866582122322633128], [-198363199343348168580990173016647980, 49056119886851432953185374664, 389838100588251577109935400], [-377105962004804448308761503875787716, 1729510952345559552168951324, -976950917132439047774380358], [-697742021008072902506447251338046456, -21210493820704414748774630728, -807824326824694026229671636], [306488740529796478229399028221361882, -11716724434134278770651248380, -464053005045546531704706392], [-504927524425310717131203875414305080, -7331888784361949685528556004, 1447051161229514747350044605], [-462143167232905976558097964157164614, -14891057643964291427217446836, 171985915292665721788313194], [341174115524874909056347841921938660, 4029068742204071270048312988, 793684130840643354291804386], [-49873212150691360406848068941419698, 12375076245440746830530090301, 1827803092300429739990433364], [1641838733683475127655023402301713678, 783984186329498360326831841, 1128202661313278640671562023], [324032832254619834616893156077959858, -35930057035754732105584292200, -575092695430253931006216994], [1136036673359467766279177138950443864, 15463174273419234582791546916, -1641854075181815119345568947], [755463031787223293385377665502048746, 28015895439867965178125458576, -872326768842976468867213234], [287479753931522343340112989734791854, 11561045690760459345182103393, -400216270268892131387525530], [-148547481245945613446251432504281136, -34921474868786027840066236328, -725905184984749876305195261], [745123252012638062136374458446764206, 32429029213560156233312897241, 1462773607021269619129112781], [97492702604218767809144484503372194, -32976299720480423350522767852, 1075530359272452387309788866], [-281971433470769819502978514792119524, -12388111565364459116519729748, -1538087611956911382146271502], [-354870957116244267734746056590222836, 29796099913037856038650464558, -1484683080404578630738086064], [758914563173108260882871916312422930, -16668289746296770204079339782, 837751087184830090238852062], [-1655505678757347544808689902314232050, 26311742365241237332203622185, 688718666851895836527175028], [263601182936166013977512374665034420, 4591089970767190241160686414, -411491038591164008160398504], [877895296218705080501400839274764940, 41907843219114196141189930600, 3229831394250167795807733466], [-218050621661037475409978218391969078, 35384532041569683231890577446, -1638195541137401514071835574], [-1253994131719118240559063729461132810, -16190834675210138363529257843, -191010396094539236736195530], [1192547106030912729534273116097524096, -51032108112746756184439543828, -1296001680284703772912223412], [-831003790415088357629885003805091792, 12024032223572228692177183120, 1881116049671527701167496323], [419945996161468353203015874167130434, -18537744244889688224256320284, 4217549890780276433323045386], [684594165006176599056147127504127416, 18201394618903348809044674436, 1890996905184585370398696502], [412286566925223619847431524447658998, -31550081885695116786044145195, 2654587135400387144534216840], [411004873273534118156795870563673974, -63403134398683251798762795659, -2330526930518850972458092745], [1757045626619638421556189024306921648, 31025932090870145545287563192, -67803243150039718385882532], [238822308994798719054181929009697652, -96720927473551852760678333274, 117114598017293119668096340], [-1094567202081305638332124856524551510, 128039732307976379712641900170, 1443508169853746152250348374], [795468987707456131583371756936564822, -3928025127530361792675761755, 641605252608363362832349486], [-3066048280372007644929077378596575396, -11880190405443454020024089442, 1458214059516684766471819948], [-1219841738675727607980417319650709862, 61287693639007140979975935664, -1205802281180647501544195388], [1167789634788193020166474970498854388, -25160007659093182232772649760, 602599589907218533100207902], [-1014807166838390665643624123844007432, 21249446074267077072057579552, 2563842033559590480235918110]];
    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_c();".
// 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_c(:prec:=3)
    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_c();".
// 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_c( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_24_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,22,sign)));
    Vf := Kernel([<5,R![-11485065000261414395000, -1387114113501300, -2080026, 1]>],Snew);
    return Vf;
end function;