
// Make newform 35.10.a.e in Magma, downloaded from the LMFDB on 07 March 2026.
// To make the character of type GrpDrchElt, type "MakeCharacter_35_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_35_10_a_e();".
// 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_35_10_a_e();".
// 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 := [-14714266, -6329061, 2066979, 3368, -3018, -3, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [14392190, 92091141, 1251392, -175920, -1106, 71], [-215878594, 86026127, -960318, -26942, 876, -17], [-771386362, 89747865, 2032484, -175920, -1106, 71], [5183590, 322723500, -5165789, -427239, 2699, 121]];
    Rf_basisdens := [1, 1, 1562184, 781092, 781092, 390546];
    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_35_a();"
function MakeCharacter_35_a()
    N := 35;
    order := 1;
    char_gens := [22, 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_35_a_Hecke( : Kf := Kf)
    return MakeCharacter_35_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 := [[3, -1, 0, 0, 0, 0], [-20, -1, 1, 0, 0, 0], [625, 0, 0, 0, 0, 0], [-2401, 0, 0, 0, 0, 0], [-7745, -393, 41, 42, -4, 15], [17836, -1747, -141, -48, -88, 10], [-7456, 1563, -1307, 60, -232, 38], [63349, -6524, 732, -150, -252, -231], [121959, -9380, 4228, 1446, -388, 119], [2691705, -38525, 5693, 2070, -2036, 355], [200235, 58262, 2698, 2310, 4492, -1509], [-692923, 73822, 15074, -15810, -132, -3169], [3932115, -371760, 21584, 1914, 1892, -2271], [-4938607, -102068, -1356, 12258, 22516, -3523], [-20307456, 130371, -39267, -21036, -50128, -260], [-4193572, 1697390, 110258, 25692, 24312, 14534], [19013732, 2081520, -236784, 79080, 59328, 3264], [-14726663, 117264, -451824, 100086, -17332, -14165], [83152596, -1252836, 39940, -33192, 87424, -21000], [43222104, -2282432, -458464, -196368, -230240, 17248], [28582648, 5003040, -221440, -141396, -37672, -55362], [137344095, 2115261, 36643, -267570, 31292, -116617], [-125757054, -4498340, -693052, 33684, 155256, -35818], [100225075, -6511948, -344212, 329058, -329596, -209895], [-199604204, 3368831, -363519, -633804, -469784, -220582], [236942797, -14208878, -773810, 199110, 676764, -66113], [-88341404, 6829335, -1099895, 1025412, 3264, 331552], [193752564, -12005782, 6675574, -1283592, 493472, 234896], [640494257, 21136281, 1760679, -1275978, -1111636, -169781], [108604591, -14948710, -1241210, -1084110, 1386292, 295509], [-265727192, -26927500, 3461580, 1445448, 1364160, -746352], [-1049258319, 6466776, 4495688, -2159094, -3436204, -258099], [1190628885, 60383288, -2590360, -838914, -2355988, -1194717], [-79624878, 74882574, 1695154, -2913084, -3935304, -756338], [5940971656, 11766848, -15529216, 1209708, 901608, 378266], [2837211209, 40219017, 9144023, -2164350, -5251708, -1091991], [211106814, 64588956, 17365540, 304584, 2049440, 1161224], [45238278, 156389542, 21837306, -389436, 4201960, -1717630], [-2991651080, -20566009, 11490393, 1892772, 2320624, 2356652], [-1996579570, 54763439, -38379535, -9674268, -8527696, 585228], [9101980548, 52612320, -27174720, -1602552, -2266624, 533464], [6626860716, 12892182, -4459414, 2876220, 22466392, 4213750], [2620990847, 186934367, 94353729, 2147478, 16687964, 818719], [-1049236223, 152133080, -23965304, 18815046, -5785988, -2136393], [-8987099387, -128465028, 46638980, -4513842, 7657404, -1508545], [-5056480158, 263613296, 81156560, -3908676, 10755080, 8100834], [-5731729861, 199991989, -107785429, -10191966, -26061300, 4032899], [13148192994, -901551069, -52514243, -8404680, -3084040, -9203794], [-14658105922, -874869849, 18942873, 12224508, -5637976, 2588650], [-6084445825, -255830828, 117700620, -29679126, -67520092, -138527], [-13517868092, 979331442, 23211470, 12318204, -37508792, -604238], [-4969590315, 44506981, -153879173, 30849210, 64860308, -4355539], [19782102869, -1245837750, 8891222, 4586430, -34563636, -2981605], [-39881679046, -495950150, -134632250, -11731644, -60143208, -1285610], [4729869972, 1222740908, 114777524, -17726172, 60842472, -22058638], [35813386898, 646960754, -236341938, 39507588, -3065048, 15653690], [-4888841260, -266261096, -47056216, 34744644, 122040184, -1815650], [-17566221265, -1437476354, -42011038, -12189882, -52840132, -41114457], [5608235180, 623024368, 11388016, 21859500, -92996616, 521974], [47055655677, -76227449, 4825465, 40876242, 68843836, 6528903], [-10848497014, 2030207561, -11483081, 29849652, -28453064, -13391106], [3034997190, 1147083603, -34766835, -34864020, -67330480, 12460564], [-63120872026, 1030919569, -656491345, 52632564, -18762456, -8524102], [-25880384471, 2492778712, 117452424, 47701842, -63863260, -10467407], [103771891722, -939034419, 269654771, 54903432, 2581120, -4659968], [-18279862756, -3597583756, -127499028, -4510620, -82670088, -55848666], [179496316228, -983253616, 140214160, 116042592, 206007936, 62303176], [130844258438, 2331641568, -1015482400, -51526656, -89314384, -89799252], [-148511343615, 1745331848, -1124297544, 19613562, 210644564, 105256693], [212424661895, -2754860854, 628156374, 254595162, -31027548, 13849521], [133484224390, 6807721187, 384043677, 69572328, -163662608, 19701980], [50871066108, 727685928, 125782968, -142958736, -111312688, 27331996], [-69573163220, -1317507269, 220483493, 9447180, -73332384, 26962952], [-36256213441, -944685544, -1236217304, 371138538, 389147908, -19812111], [-72818298788, 5926170440, 42592280, 325481256, 84806528, -63638808], [-29466033038, -11367059168, -498665568, 115831788, 411476008, 100080266], [-94208739143, 2915088541, 228305827, 22982358, 246470636, -78331813], [-330021555088, -9632350605, -1361873939, 1875840, -367012584, 96339526], [367770271977, 6474056429, 770097875, -111733782, 125524300, 25863259], [115494644368, -4041538972, -441757860, -292153884, -604124232, 248704590], [-65376332636, -2279349220, -1024907932, 427303656, -268497184, -152074296], [202423126051, -3869825299, -147833261, 446114514, 251098484, -87525043], [42775814457, 4097804119, 1771438281, -381284286, 611597732, 120748609], [166133694002, -6422429412, -1763379836, -1036823352, -228054720, -69367640], [-575318889174, -1264778210, 1004484962, -297786636, 53522120, -60368622], [-195195435019, 4896132780, 2891275284, 393115674, -190812860, 139832609], [335210039025, 25937382371, 1631828381, 123593082, -141570260, 82264195], [362963812767, 1632961676, -603037420, 332968170, 1004530484, -30486555], [83810193928, 14449193110, -55823766, -148375236, -165459960, -183117294], [-402075375107, -17501066222, 2868279310, -634162710, 701163604, -70012467], [-606214298302, 17184271885, -1130830925, -555031956, -1038672360, -215405930], [-411068732979, -1776048164, 1505498244, -542050782, -354580556, 299344229], [-690057151454, -10924329002, 2100300714, 1381297164, 591192712, 6978482], [283567680977, 21197671973, -2044932613, 531023286, -320547484, 381362073], [-38278548401, -16163128005, -6057611419, -316090926, 866576444, 158719983], [-419971880642, 1770539205, 5207110171, 877502664, 21875112, 38219050], [402412400358, 13663214988, 589772020, -468399672, 2104366656, -363957440], [-223470969779, 21494377478, 4558004698, 2256698790, -231216404, 195284643], [11467973048, -9750555824, -4919091632, -1046451264, 945507760, 66697860], [1391647087753, -16590389141, -6482181867, 319678206, -175255700, -501047461], [-818363504029, -7204642206, -3707654626, -1794362946, -541119364, -503130993], [-27091547500, -45620983698, 3206393074, -518070156, -2785871016, 252600382], [308751755116, 21599082800, -5861674064, 2526456648, 1592508128, 40646336], [1374479609050, 12821249008, 363565072, -3043951224, -1203787424, 231457608], [1187519599986, 15315474724, -5712598148, 1208586132, 203801496, 4654750], [-1140884247054, 8585366505, 10288245015, -1223883024, 189271712, -85356536], [1281839292370, 10166016080, -3054495600, -914623740, 1958394904, 635404334], [686747598626, 3064672865, 4403496351, -622853784, -1870461120, -164924544], [-1013321135391, 47721400759, 11981373801, 1054094418, 180889060, -147304399], [-135066161034, 12112568752, 14253424528, 2142103632, 2255906768, -429744556], [524604990178, -33174522643, -6506231693, 1574891592, -3564194440, 403185518], [3708653391526, -32289511436, -441616660, -407254440, -669616576, 559242456], [-1444662162832, -35029445048, 15606526392, 2068894068, 3603905144, -1389435602], [-790918875457, -49384439660, -8513033140, -1617341706, -1710959444, -739429709], [1720603208951, 90843573507, -4001072291, -756064746, -3122010084, 226601023], [1480714391874, -122221860128, 3476606240, 450856680, -526879136, 1028166856], [528026440140, -45141175937, -6274477119, 1572532536, -4878555040, -69323720], [-1912321650054, -8718031940, 4789256068, -3215485596, 2611482824, -699935134], [781799961579, 58561018286, -10779648238, 2026767138, 8088598100, -631055163], [161547132753, -99850818753, -9458374111, -589301970, -1586341340, 81980041], [441179506410, 29594695178, 16817765942, -1958135808, 1762861424, 455539452], [-2721619879795, -76157048216, -15173956808, -712527186, -4150618964, 588713139], [-3999804088938, -47229653783, -12957709449, 3764980020, 1944599984, 1007468956], [-488100288663, -13315843162, 2566388122, -3870117510, 214280884, 366484269], [152553495230, 75733401340, -13442347260, 5043949812, 1567230504, 285385578], [3607948000357, -83553623433, -4571073335, 424742502, -5491921828, 1020243047], [3566219791387, 93691174959, 33114290897, 590097546, -1110983628, -1075169059], [-1813788047169, 116618537256, -15519252616, -7477433178, -3368727300, 194167079], [4651538745530, 43508253628, -1635573116, 3093328668, -333056984, -138756534], [-7015359415248, 119078358353, 2819435407, 209407440, 607395672, 830112790], [-1654007129169, 122330692863, 3828885793, -5681654814, -1089407172, -1658577617], [-6071056018722, -8008514724, -10160784796, 7822866276, 258155512, 477862558], [2391971336387, -124310086099, 3851882547, 1891072326, -7616671860, -2563034613], [4038448173750, -234830060454, 3697199430, -3780305976, -5455333248, -1979134920], [-2992648436461, -173908901458, 23961722738, -6285168198, -8204711836, -95328543], [3420786581966, -40792120864, 486176864, -2297940384, -4882689328, 356119476], [-195484828024, -29319618451, 6494977139, 978361392, -1627932008, 3240785062], [2235969292968, 107799071811, 33178909309, -1052632320, 1332629584, 1943063988], [-990357105822, 94410559599, 3417301041, -2594722332, 5666118496, 2128998152], [2092861628217, -297186746675, -14573941901, -2248560942, 15109547212, 2611632555], [-2645697918376, 149745006478, -55562277198, -6635992080, -5303806256, 2381326676], [371429666843, -224831326935, 38412568215, -2208247134, -3557039340, -2115935211], [967358971645, -23351652462, 55763336974, 11528661042, 16111732436, -3206862499], [-624809575966, 110170130674, -33870057490, -9445658244, -1596986120, 450430774], [-1015129239417, 198423988084, 10415358444, 3258676122, 468222628, -2781660895], [3991886535837, -243533542168, 21711302712, 7193784450, -590399788, -3450459395], [7961063400338, 389924538860, -12218246828, 346276872, -17217995664, 1762382668], [-3046172609582, -152688629876, 21571598484, -2436289848, 4087396704, -149522832], [7766638516612, 198567488056, -44509179000, 3102553920, 7898638752, 3394414200], [1689626756305, -61259694626, 5801636610, 10691373498, 18126364676, 3280522009], [6298939253835, 120972061022, 10750357986, -13411450734, -12574293996, 1107736629], [-635970751964, 76191095858, 70773492110, 6876541788, 13868084584, 3676351738], [11940238296673, 34477389570, -29017673858, -489458838, -9352870284, 1246071373], [7294686869240, -79867846824, -33726302488, -3519756576, 1940508672, 5584756688], [13596394891543, -24718572888, -10299522984, 15853438806, -6183426324, 3371815179], [19543852610518, 74402703028, -23117505684, -4585936020, -10607400456, -912185370], [4114098865329, 693310104837, -31805575589, -19953114294, -18621799612, -3338118871], [1947760987814, 302012813430, 78864985290, -11863195320, 27317978512, -901052428], [654450498378, -316555441965, 19989079469, -5768671080, -11916547328, -1366393808], [-785771245487, -10621588072, 12641082888, -22398511290, -26428455572, -4322876269], [10421194255757, -241025552238, 8727517422, 15390984954, -2219205436, -6066829967], [-13212132220427, 33848127640, 2797204680, 11368901478, 10481456332, -2727601861], [8842721598184, 333118082082, -71453676578, 8601788352, -21520939392, -3912560864], [16241304881583, 257994198542, -29486440622, -11787607434, -12754446164, 1446449427], [-20136259918889, 209953017558, 48106878410, -2550584214, 10579425460, -5776983419], [329638282454, 32878911053, -94952700653, -27905976504, -26996187960, 3004101682], [18715542407408, -386240521640, -27947206136, 2805446904, 32495936640, 2543850376], [9539423495546, 416299312763, -41537838491, 12400325412, 36416858464, 1955362392]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_35_a_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


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


// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_35_10_a_e();".
// 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_35_10_a_e( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_35_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,10,sign)));
    Vf := Kernel([<2,R![-15252160, -5838048, 1934724, 32578, -2928, -15, 1]>],Snew);
    return Vf;
end function;