
// Make newform 75.8.a.a in Magma, downloaded from the LMFDB on 15 January 2026.
// To make the character of type GrpDrchElt, type "MakeCharacter_75_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_75_8_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_75_8_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
        Kf := Rationals();
    end if;
    return [Kf!elt[1] : elt in input];
end function;


// To make the character of type GrpDrchElt, type "MakeCharacter_75_a();"
function MakeCharacter_75_a()
    N := 75;
    order := 1;
    char_gens := [26, 52];
    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_75_a_Hecke( : Kf := Kf)
    return MakeCharacter_75_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 := 8;
    raw_aps := [[-6], [27], [0], [64], [-948], [5098], [-28386], [-8620], [15288], [36510], [-276808], [-268526], [-629718], [-685772], [-583296], [428058], [1306380], [300662], [507244], [5560632], [-1369082], [-6913720], [4376748], [-8528310], [8826814], [11986422], [-7209392], [-11426076], [4020950], [17706318], [-16788296], [16826772], [-28044906], [-11827300], [20784630], [76112], [32182474], [-58343492], [25836504], [-63520062], [-80955900], [64503182], [56827392], [-116376962], [118816074], [-95010640], [179246372], [206536888], [-43395396], [-36193090], [-92234682], [49846800], [199374002], [-394677828], [142885374], [-440240712], [275404590], [-424669768], [-516158126], [-311042838], [594308308], [-115514742], [260599804], [576794712], [460074358], [-62556126], [684235772], [626312974], [1253396004], [265350230], [569635518], [932540760], [852564664], [-381183422], [-1483530820], [761929728], [1609017990], [-1880157926], [268592322], [89947850], [1690542660], [-1133327458], [2199426912], [151737838], [990762560], [1773756228], [-277010190], [-2947584986], [-2766873378], [-463552952], [417921804], [-1509728880], [-929459936], [5128027932], [-410649340], [-5020408872], [-3249259170], [-2109501558], [5289111988], [3046135142], [4855369564], [-1277621406], [-4712645172], [4577997210], [4951192172], [-8518472066], [562247364], [-3621104082], [-7481036760], [-5812702678], [-3840510056], [-1704841742], [2808092454], [-2543654980], [-151146448], [-12362510478], [-2867439812], [4106397384], [-6910997502], [3424439940], [-6764370178], [1749591838], [-8300111046], [12123151668], [8218456532], [4722309342], [2789746910], [1519846560], [8117607664], [10324065658], [-13536483820], [17193592248], [11247841832], [-16306837166], [6140694522], [24506888450], [10172166858], [9791348044], [9757815954], [-2787060150], [-7999831348], [-10240182138], [-27868227152], [-23512488876], [-12859810810], [-7998323880], [-4208270462], [-31930660986], [21800201180], [-10472788512], [17778707194], [-7642529838], [27637547308], [-32308710456], [-22714240076], [7509250032], [-24937401040], [-8662051470], [-28265471066], [-46708171458], [46739235324], [-38242017882], [49001211184], [27292866732], [-3944816706], [-474320472], [12219675032], [36069016114], [-43042353550], [-53445281142], [-44667971220], [37043931542], [-20744302488], [41928207238], [26277636200], [-10073577750], [-33405172948], [44056412262], [2507982928], [-5417591770], [30835078984], [10898755332], [-1507457822], [2977370694], [-50404611792], [-54550710570], [-53046962246], [28388977228], [78010890170], [-87554792448], [-18892935362], [5471787108], [-50839212508], [-16632393618], [-90942990516], [9252160998], [-1526238958], [-69987355622], [106208802174], [80956346328], [-104953881570], [-63559968328], [53055999634], [46815052130], [87185488140], [94874107554], [-79138606840], [59487959868], [74432878170], [-21631998388], [-2147989106], [35785563222], [-105343475552], [-86990440236], [82463405880], [67606765082], [34170328984], [16339931682], [-19605375576], [43421889138], [99621339422], [116496449600], [111909620370], [-55367796152], [-86256222996], [1644781310], [-146633749962], [-49850812080], [-97432739216], [-125618264868], [-92779102742], [9842395700], [-182297382808], [-96967418118], [172475247988], [1916042304], [22535301650], [-217500703542], [110044896060], [-52364228328], [-188204724852], [-6162260308], [93899832448], [-175975966330], [18097266318], [-7468135320], [-187329343736], [186979344852], [-186443762980], [54905012208], [46202515834], [-210324778398], [225929358024], [-10019444230], [-289716898542], [5102347140], [173434010222], [123846007924], [90626230314], [119282024374], [1727499448], [57637667244], [71934260990], [-183613988342], [55455313614], [-319033631980], [188905686750], [-87528677718], [-377667439772], [-373810099782], [250876406822], [182052699964], [433110042838], [-378886432360], [-260416842386], [-367455089792], [-110747160156], [-373433284810], [-156185379718], [-55517186748], [297224486448], [-127147532368], [-231178666056], [-480447596818], [-361594871276], [425024516592], [-302846138642], [-10897429206], [288268865360], [516975546690], [-1090675938], [415121375484], [43706844438], [352007329692], [-146028443462], [-334507355250], [370538139752], [-147804306342], [-218478916260], [344131402204], [225340591558], [-589130562366], [267447146600], [451803980508], [254122592252], [313789369534], [19692662484], [-292101366730], [103638848520], [127915158418], [311427889968], [-519453675450], [-226720816878], [-430452142052], [115350206904], [568396625690], [-162713568540], [805074529872], [732343532158], [494846919570], [-571702944988], [-331012530986], [-893747546658], [378179521288], [-242137183722], [-175663129678], [128447279300], [56587778308], [-252857211936], [-206969752422], [34381491542], [-285118552686], [-360643412440], [217650879948], [5989999772], [-250297853436], [486654790070], [-555276741762], [-472867227238], [983640703624], [-559884091742], [-493933888986], [-189865476330], [546144476912], [-927880020222], [-341624955420], [993803298302], [-458165111516], [78099372672], [545007917754], [176820607652], [-94226761946], [-584639867058], [-642997293272], [-1150758109570], [467177495958], [-1192803420480], [1048312844892], [-665080738626], [-54091787352], [153489547954], [186279427482], [722776194864], [-398371944900], [1108846724524], [649884440998], [496539879474], [-993658338272], [-262480806358], [753742448772], [-840812008660], [20063765328], [-1465893871770], [-531791328208], [1215644830234], [809421011220], [-1295234916768], [-556053815522], [1776321557730], [-371633343146], [1587300812142], [1257982573398], [18871681264], [-5882435106], [924691123940], [1391969440728], [-305716540888], [-1850141264846], [-477799976972], [-777178366896], [253887661250], [447656072538], [-644036157540], [580393000684], [496069122552], [-734262460682], [-68216660440], [-116770113750], [276193658732], [-1530555860778], [-1914224151370], [248722338798], [1737069989224], [331042223814], [-860276058570], [254323989632], [968582313514], [-608577372318], [-670865706932], [-186345219900], [1360654487758], [819675281514], [-1894312415772], [1336832635652], [1335978298534], [1544870368782], [1039354421760], [-2234302426016], [2301046060734], [-1590927613032], [332245758030], [99899694034], [1933304942064], [1271575943580], [948584063878], [614503513554], [517797907788], [382722568650], [-312415597348], [-2251460069400]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_75_a_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_75_8_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_75_8_a_a(:prec:=1)
    chi := MakeCharacter_75_a();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 8));
    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_75_8_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_75_8_a_a( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_75_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,8,sign)));
    Vf := Kernel([<2,R![6, 1]>],Snew);
    return Vf;
end function;