
// Make newform 70.10.a.c in Magma, downloaded from the LMFDB on 05 September 2025.
// To make the character of type GrpDrchElt, type "MakeCharacter_70_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_70_10_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_70_10_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 := [-135, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0], [-4, 8]];
    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_70_a();"
function MakeCharacter_70_a()
    N := 70;
    order := 1;
    char_gens := [57, 31];
    v := [1, 1];
    // chi(gens[i]) = zeta^v[i]
    assert UnitGenerators(DirichletGroup(N)) eq char_gens;
    F := CyclotomicField(order);
    chi := DirichletCharacterFromValuesOnUnitGenerators(DirichletGroup(N,F),[F|F.1^e:e in v]);
    return MinimalBaseRingCharacter(chi);
end function;

function MakeCharacter_70_a_Hecke( : Kf := Kf)
    return MakeCharacter_70_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 := 10;
    raw_aps := [[-16, 0], [29, -1], [625, 0], [2401, 0], [-21573, -222], [-41869, 1425], [7737, 1779], [-218074, 6801], [379350, -8625], [-38145, -34926], [1946252, 27729], [-829294, -149049], [-11068116, 200427], [-17156698, 32841], [-30355575, -144717], [-55689936, -345708], [-55750452, 795096], [-77422468, 752181], [-153487336, -1083828], [-81556128, -2194992], [-92189290, -1862958], [355853525, -2989272], [-192490212, 4942146], [266701512, -6491913], [135985229, -4556229], [-156859338, 7295343], [-550379035, 2638371], [157180290, 17115642], [-396772771, 3105348], [-139139298, -21934071], [91000196, -190572], [-1872966414, -34300863], [-1267362048, -23029419], [3377783090, -44103276], [518924394, -32794482], [-1833360907, 43143990], [4811736698, 40088028], [-11800641886, -10479240], [-4212757371, 137688159], [-15028512735, -31802427], [-11000983572, 83811000], [10307011448, -69462108], [657119259, -288172470], [-3919449184, -116782047], [5772803184, 120793113], [37328191772, -48654822], [44481489125, 102869196], [19810997861, 506760837], [42048565545, 48458673], [9071862236, 42215115], [-27298265880, -46186956], [50096232945, 15928254], [70071308210, -142328745], [33914304006, 671067336], [-37556781150, 890709498], [-25740994734, -609482076], [-36596349414, -1029824718], [17593678532, -556727283], [49043917394, 185552706], [21305038035, 941939754], [-50373515737, -144758625], [-210056918043, -237780663], [-50230843585, -303604893], [-486086634, -241484775], [-222733902049, 560873079], [-42670158618, -1995604866], [-41535614764, 1548517152], [374851014194, 430757460], [117983539986, -890610555], [-62011856374, 1864134981], [-336310024203, 703002621], [104950116432, 35278044], [226268613281, 1893297807], [-132005726680, -2416140381], [476570692316, -849303432], [-203977400724, -3563742270], [95979299241, 6891815592], [223575656465, -5727620745], [-580720414671, 2892511608], [715397901842, 951028182], [311543851800, -7063463964], [-49573685995, -1833922890], [-20416015473, 1944578772], [-319349289058, -11532003516], [-187221527530, 9056599488], [350406019374, 3160474029], [-36681798441, -14543408526], [-355000800640, 7814292855], [-661862978304, -1938327744], [916588803284, 1403970123], [139230503547, -5498786853], [608101896714, 5206938945], [422628044726, -9837610272], [-90029576535, 7945729458], [560560268207, -15046471746], [416396007627, 10700996403], [-1465988541822, -8495394852], [-2975248503186, -2551943133], [-536510595292, 18154295964], [-1839326013745, 3731392818], [471049734188, -17219460015], [-1515408860208, -17905605996], [1540253638548, -8728132848], [783759006330, 24815764656], [-762457064380, -6467105358], [-431446249429, 38872620171], [545771808480, 12134707638], [1318417612635, -11875617501], [-2440524923337, 2656757868], [3684634778714, 187657332], [-67797558853, 14625579735], [-737088246862, 44101211724], [-2992483808826, 31739779122], [-131974639198, -20877270741], [-3037319444401, -31478462010], [-3706561422558, 13551130560], [145069104773, -25063842249], [-3062945198904, 33951404502], [-205954293378, 70021086921], [-4176091765953, -17098893396], [-2319412077904, 49166535354], [-3970139791960, -7993069539], [-139662907125, -73537973637], [-6020374080924, 35760761067], [-124730203684, -57209602242], [-4751167048725, -5813940102], [2433157305551, 65312151348], [4405741555338, 88212703479], [7318271288792, 15327835182], [3163214818727, -23814662487], [-679900188349, 82421276898], [-7380483029832, 66036569466], [2290404790037, 122253759828], [-6241197445240, 22862782662], [10545658553130, 75584722077], [15148692683282, -2928118068], [-11779069067949, 20520884013], [-4836051782527, -34663447065], [9957572460177, 65940586761], [15630512334825, 17275185576], [9032348848550, 135962365002], [17384813807961, -19816311750], [-19290184730716, 46697243811], [-7501437726090, -45363190296], [-13441515394780, 56847739251], [11365954973478, -110481886971], [-13036198676470, -9191200176], [-341571131082, -14135152596], [-16535350865572, -35134458264], [18401166379704, 80768780427], [6746842696142, -50067832959], [26471394525984, -13131664548], [-13434138807664, 109749236199], [-13405671152880, 153082861824], [-15806501549482, -208226938989], [13645356973704, 17456998554], [-13122256062175, -139862651814], [-10079680153248, 184175477574], [3313672783661, -121606884279], [18391556201364, 127150455117], [-5276767529520, -163081080021], [22081997483160, -94767637299], [-13678904481562, 99990233274], [18101648936760, -33252356331], [2615895136962, 311797029837], [-94384970325, 334617458259], [-5284216000528, -532882022328], [-4735502632555, 497275661133], [-5994579011515, -585657744174], [22286843710734, -343009598730], [17358961685832, -167320323636], [-9671155784314, 211122035190], [-12796732140261, 45402009996], [-17634341966074, 469394300970], [-8094817954162, 1181470503], [-23390328444564, 440985324324], [-13804969732873, 497355895512], [20424622354905, 313028111340], [-4983816473428, -353441924778], [-28097965683844, -104928469893], [8336794012544, -456142067991], [59649253682328, -9358093953], [34561719017858, 441046900395], [-21036924982998, -511171776768], [17162208795912, -409065477789], [-272243206698, -109668462741], [-18443460241108, -9781258866], [42036580058573, 28366923051], [19110506690369, -80069000184], [9838231677132, 1069360461141], [4287669088334, -320981624292], [59769272884950, 68875231815], [-97518824995399, 43400675484], [-5720753296752, 526445178807], [-1578401918820, 1170742116918], [-14649229475901, 367803982587], [-87763130623081, -260904890130], [853049790020, 763276871601], [-13692083724519, -234906903777], [-68258815262595, -485768550729], [-34656956765850, -1117990989120], [-6585725469334, 231070354656], [-110862638151082, -55261254438], [18978157546202, 724610126889], [-70959827812878, -32202278739], [78501789869445, -1029636786921], [49831021557998, 1236078028092], [-27581981332872, -1153156320333], [-42328118410218, 1325580197328], [-21626630822788, -920238548175], [-19296770636356, 1666902535047], [36388533299634, -1297983815352], [25726155603092, -1155956982459], [-54206513463255, 763651858917], [-18430867920774, -327925305030], [208234102461488, -84233234301], [146021124506678, -388830402501], [46870680733452, 751926084285], [66061318220466, 41390810055], [-76714159596870, 717245051340], [-24150494177998, -2448003862854], [20966653189730, 2509563154680], [-118731165545931, 1564915998594], [20421009179030, -992255747274], [-101397714397455, 317863069725], [-137617441669426, -1710135000498], [167001040557, 814046910225], [-32607901233561, -380471834280], [56008125561557, -1727342557101], [-200278381541244, -394927293894], [-43951298191360, 1229059980135], [152517820465406, -22093439418], [31432714862672, 1985291531370], [-205201125655215, 283515621354], [26025413468105, -2985333562431], [34030200111981, -144288317091], [180914402233736, -1632410139129], [-204368217810048, -880666633542], [-90402805748583, -2546377575444], [97964268596610, -28222903185], [-29001512313360, -2478811999812], [257928618994760, 80356012002], [33478219796345, -154227015843], [68493897322766, 2760423939300], [112634185864083, 2458890698259], [-37806168910686, 1121267516169], [1667618634656, -2866122620262], [-155527946960862, -2592095833362], [235326311969045, -504613555410], [-181938513203322, -458204645433], [-282749306693146, -435443879097], [433985858663022, 108873561534], [-141001501610568, 2802980564826], [207063601894184, -2661386626578], [-171833287501206, -1052422604646], [155745469793967, -902098762722], [-245514546492442, -2025739137654], [-13521865671676, 4479618630576], [155897554780323, 962238685797], [134068683534707, -912221806851], [-255266490124210, 442387853853], [63603026211090, -1772413546602], [-48370819455208, 431282423730], [304691919340871, 548176546035], [428223331984230, -23290338102], [56803987028474, 933698824401], [-73788700910367, 137563768596], [54791589035310, 9364771344], [-377959967797768, -3575324545056], [-93084013836090, 4562497713729], [552707201877104, 123092666235], [82673396516972, -6658511175171], [134128557160325, 2500986022689], [188036418084620, -98874918048], [8024427949010, 7520640986490], [-142579019990191, 3640809397605], [123685779278412, 6385982411580], [-34798509886318, 4423525508988], [-76116287990575, -2570617598424], [127579287787218, -5295830594106], [37078405865565, -1651853936289], [-738285417069859, -180635382816], [-482145275436528, -1320169655400], [-261623917772050, -1315295200542], [-764386054241887, -2074255702143], [-590119412842617, 1991691677280], [899384887845314, -1758704218827], [-319324612934826, -7193866294611], [10484384545664, -4285168800], [-323756533577712, -3648395969700], [-487020372046143, -1807153906950], [182042812898571, 1208509070931], [357324505730208, -2706105026379], [-601710243006900, 4309757527395], [-205369790046442, -5672336682141], [-1146957086727792, 254169030261], [651486919121030, 3754033420266], [1215121805685963, -634335200703], [-472691577984804, -2351609298426], [-881256999823267, -62089021785], [675058002086801, 2374949802393], [869212417511130, -3356129301228], [971243379299843, 303700826676], [157837072410936, -436575860964], [192591979244921, -11570201379846], [-358382044373566, 7652584655331], [877810556795022, -1737087431289], [185818818304520, 2607906156492], [285129866479392, 1315126286538], [727570830362732, -1047846609294], [-443987029044024, -5239053326382], [-107100511860549, -5681978213916], [665666763900414, 8462572370748], [278411352664274, 13242062915328], [1060329758828166, -2974058832951], [342932742325280, -6799282419375], [238697892591786, -745915760316], [-923372102559297, 3885797185890], [456128592578657, -9247309912581], [53793556762005, 7213554116640], [110170624576910, -4084225224870], [544394523349640, 904651245135], [-65923554495126, 11978411855574], [720204447500468, 1893314764443], [370858234156494, -8639024990520], [1565267545073072, 3608825133474], [396045172447193, 7844896269144], [-1250952885132532, -5559672245634], [1210851235826880, 5867119287117], [408092668417596, -9605023277115], [-954851660633074, 10447077411204], [-411624116144964, 17199916092291], [1031779920803978, 283871956914], [-1174784836983489, 1690231218123], [-48937019905636, 15760071582858], [-459802948376547, 15407150914575], [-632414384409523, 445720262190], [-508907980378194, -2094686047248], [1068662675874494, -4107200932341], [-808531500397831, 11193417640161], [-780652312571770, -2723424067332], [-518734710787020, 3845220133848], [-577121273453946, 10430083069779], [2040578687577683, -3628070979552], [209618659635174, 5330847431931], [1090709419181148, 13265396730000], [734581142479910, -16299615828690], [-712089488750176, 8017574023191], [565755978338778, -18911243083197], [-1504776434441559, 5012211665235], [564765791307860, 24242981345964], [-1566434286695932, 9231922511307], [-709740867090879, 20988577664748], [-555328444863679, 2459120642901], [520430185396697, -18776463702078], [512260399202250, 12169965481098], [-1330704893396490, 13099553937894], [-410404005127098, 18084451879245], [1828049295186894, -7268950316301], [594505414317522, 2262207263856], [-2668287235848652, -6342887616351], [843791317034604, 16799196277476], [455740429506480, -19429747471923], [1969015256581119, 1995776386326], [427667486588996, 1980405254256], [493423991319998, 2529534438387], [2068577914737105, 16379311651479], [690858369955490, -13172078646471], [130319837842469, -35917776717276], [464976716044503, 7192133577558], [1223404391384156, -698384922975], [492011854266660, -8351242625160], [-2324619999960765, -16421308445280], [382862649433454, -10625526418884], [-148571121871006, -23348099945016], [-1344626609043912, -7772383013166], [-1227755076617709, 20845962260586], [-521302113513445, 39780431768625], [-2245153885837914, -16945265472228], [-201062203575697, -24460286706375], [-2394594900409302, 21915291322398], [-997048198513134, -26083116991890], [-214276606572688, -50342122750536], [-195326644949934, 22607938382022], [-1535659296848152, -964602056259], [-3750924120776211, 13602192182925], [939926061929783, -29687360442210], [-1007324705857813, -9370805168925], [1724297907693212, -15402869845062], [1923334625829255, -24699320524707], [-2456530932557647, 9005931562404], [3101143897666797, 18195184262655], [756889794900693, 6323105683812], [-3217730783431444, 9779656401324], [-902719148000673, 11152659009402], [2018820270337088, -17756265723942], [1549014325958648, 41689663187985], [1435576153583880, 3594897170523], [-1338390405446701, 13004354312862], [-882964729036542, -25626888201252], [1554717844982936, 6892605457389], [2116023390057192, 30653594226540], [-2020070515953514, -25606864853229], [1338867463955349, 8544825468543], [-4258407113092092, -4817928319428], [-315942887822566, -3574461008892], [-3085013629270090, 18822389047032], [-3236937783104985, -8981246629560], [28005171807308, -34537636203312], [317685307669668, -56219193830244], [2534114119338005, -13218003435099], [4719819467454726, 6819070244646], [5060105908558602, -5264616171147], [-4420307448644716, 19232524701660], [-5564781732449554, 2065525665777], [-528600658243944, -55503611626104], [-2983864092896289, -15805917672030], [2057145185438564, 43532738276370], [1439965962444102, -48016762402758], [-214177669526979, 40237015623819], [3585904828072197, -37559892540414], [3977699214715706, 26421204329820], [563011413876606, -49156010325912], [-349013383973772, 64373948367198], [-402186557217553, -34547818081059], [1235027097643089, 42685859925765], [193721675640708, -1305398975334], [-3485725200550902, 26603559934698], [263812611071864, -21223023004071], [-1160595365479884, 7427533666395]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_70_a_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_70_10_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_70_10_a_c(:prec:=2)
    chi := MakeCharacter_70_a();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 10));
    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_70_10_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_70_10_a_c( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_70_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,10,sign)));
    Vf := Kernel([<3,R![-7815, -58, 1]>],Snew);
    return Vf;
end function;