
// Make newform 675.4.a.n in Magma, downloaded from the LMFDB on 24 February 2026.
// To make the character of type GrpDrchElt, type "MakeCharacter_675_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_675_4_a_n();".
// 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_675_4_a_n();".
// 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 := [-2, 0, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0], [0, 3]];
    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_675_a();"
function MakeCharacter_675_a()
    N := 675;
    order := 1;
    char_gens := [326, 352];
    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_675_a_Hecke( : Kf := Kf)
    return MakeCharacter_675_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 := 4;
    raw_aps := [[0, 1], [0, 0], [0, 0], [-11, 0], [0, -4], [-29, 0], [0, -12], [29, 0], [0, 20], [0, -64], [-268, 0], [-83, 0], [0, 64], [232, 0], [0, -92], [0, 72], [0, -68], [767, 0], [511, 0], [0, -168], [-137, 0], [-475, 0], [0, 136], [0, 60], [-821, 0], [0, 128], [-839, 0], [0, -180], [218, 0], [0, 356], [-1244, 0], [0, 592], [0, 316], [947, 0], [0, 136], [-2311, 0], [-1622, 0], [-2243, 0], [0, 644], [0, -320], [0, 552], [-1591, 0], [0, 1124], [3481, 0], [0, -564], [2351, 0], [1703, 0], [-1388, 0], [0, -1112], [434, 0], [0, 816], [0, 664], [-2095, 0], [0, -48], [0, -424], [0, 88], [0, -1764], [-3319, 0], [-8354, 0], [0, 608], [6208, 0], [0, 1460], [2320, 0], [0, -188], [-1307, 0], [0, -488], [-5173, 0], [-2621, 0], [0, -1816], [1955, 0], [0, 280], [0, 132], [-7895, 0], [-9803, 0], [10505, 0], [0, -256], [0, -508], [-12422, 0], [0, -3656], [7265, 0], [0, 748], [3413, 0], [0, 2988], [-8642, 0], [524, 0], [0, -4280], [0, -780], [9466, 0], [0, 764], [-11315, 0], [0, 4116], [0, -2104], [18493, 0], [0, -3020], [-12256, 0], [0, -1740], [0, 4948], [0, -2892], [-6833, 0], [-10555, 0], [-17291, 0], [0, 2436], [0, 3872], [0, -3700], [-4075, 0], [-6995, 0], [0, -1316], [0, -3528], [0, 4288], [-6550, 0], [-12827, 0], [-18767, 0], [0, -1780], [24581, 0], [-18223, 0], [0, -376], [26296, 0], [0, -6048], [0, 104], [0, -6376], [623, 0], [-27875, 0], [0, -1556], [0, -3696], [-10600, 0], [0, -3204], [-33523, 0], [0, -7512], [13084, 0], [19222, 0], [6320, 0], [0, 980], [20333, 0], [14011, 0], [0, 6124], [-6289, 0], [0, -1704], [25675, 0], [0, -784], [0, -2376], [14312, 0], [0, -652], [33343, 0], [0, -4332], [3593, 0], [0, 4040], [4741, 0], [0, 2824], [6887, 0], [0, -1980], [-13475, 0], [0, 1236], [7909, 0], [0, 8408], [16999, 0], [0, 9200], [-28348, 0], [0, -7816], [133, 0], [0, 11500], [0, 10684], [0, 10164], [-22061, 0], [0, -7884], [0, 4856], [0, 2812], [-35017, 0], [-13646, 0], [-27187, 0], [0, -10540], [0, -5416], [-22570, 0], [0, -2660], [7603, 0], [46847, 0], [0, 13624], [15968, 0], [0, 1788], [-15797, 0], [902, 0], [15379, 0], [0, 12488], [-30674, 0], [0, 2940], [0, 8048], [0, 6056], [22975, 0], [69001, 0], [-60667, 0], [0, 6492], [1591, 0], [0, 11944], [49007, 0], [0, -772], [0, 3420], [0, 15836], [39395, 0], [-60113, 0], [0, -6668], [0, 7176], [0, -12644], [32249, 0], [25351, 0], [-62899, 0], [0, -11472], [0, 552], [72497, 0], [0, -8236], [0, 13556], [87401, 0], [24649, 0], [0, -3452], [-30413, 0], [0, -14252], [0, -10928], [33815, 0], [-56756, 0], [0, 12668], [0, -3720], [0, -1960], [92801, 0], [2540, 0], [0, 7312], [-3836, 0], [0, -6100], [-48265, 0], [0, 23428], [0, 15324], [89737, 0], [0, -6532], [3643, 0], [27272, 0], [-27268, 0], [0, -12764], [-11999, 0], [0, 2764], [-42955, 0], [0, 4836], [0, -584], [0, 18936], [0, -21416], [-78595, 0], [59047, 0], [-16333, 0], [0, -12844], [0, 24644], [49435, 0], [0, -9536], [-34720, 0], [0, -13584], [-18794, 0], [0, -23772], [0, 12500], [-114091, 0], [0, -7940], [0, -15228], [51761, 0], [11248, 0], [0, 13056], [-11018, 0], [79693, 0], [0, 14380], [99173, 0], [-110351, 0], [0, 632], [36704, 0], [0, 18636], [0, -14344], [9880, 0], [0, -28156], [40367, 0], [132649, 0], [92410, 0], [-72331, 0], [138994, 0], [-17255, 0], [0, 9716], [15158, 0], [104762, 0], [0, -496], [0, -6652], [-79540, 0], [0, 5152], [-97405, 0], [-69743, 0], [0, -31692], [-3809, 0], [0, 440], [36083, 0], [0, -4140], [0, -21532], [0, -21360], [0, 1784], [0, 28864], [-44102, 0], [0, -16736], [46667, 0], [0, 38620], [0, 8016], [-138845, 0], [-162731, 0], [0, -24768], [117668, 0], [0, -16672], [-116449, 0], [19330, 0], [0, 9100], [-85291, 0], [0, -34784], [-46955, 0], [0, -3740], [0, -8880], [0, -10576], [-947, 0], [0, 11244], [-73546, 0], [0, -9556], [0, -31748], [3634, 0], [0, -22700], [13889, 0], [-55379, 0], [0, -3432], [91852, 0], [0, -46856], [111269, 0], [83000, 0], [47752, 0], [0, -41924], [0, 28548], [-125107, 0], [0, 11504], [-107071, 0], [0, 31312], [-134512, 0], [0, -216], [-205333, 0], [0, -32404], [160166, 0], [-59996, 0], [-56387, 0], [0, 46396], [0, 8488], [32573, 0], [0, -9104], [0, 7284], [-119662, 0], [222496, 0], [0, 39608], [0, -15396], [95501, 0], [53647, 0], [0, -7808], [-54956, 0], [204419, 0], [0, -6564], [0, 2536], [0, 1392], [0, 41552], [0, 36664], [32065, 0], [0, -28624], [0, 1608], [0, -6004], [-28271, 0], [-61895, 0], [0, 9412], [57157, 0], [-68929, 0], [0, -24172], [-142585, 0], [0, -15520], [0, 37328], [-80485, 0], [-160733, 0], [0, 47548], [0, 18144], [-24599, 0], [0, 27336], [-174269, 0], [0, 20132], [0, 50048], [-215273, 0], [0, -44312], [-72547, 0], [0, 27816], [-153052, 0], [-64289, 0], [39445, 0], [0, -21700], [202430, 0], [0, 25792], [0, -53604], [56851, 0], [0, 18860], [-228233, 0], [52193, 0], [0, 43748], [-134728, 0], [0, -32048], [-8746, 0], [0, 33264], [-37532, 0], [0, -40480], [0, -38424], [84404, 0], [-235721, 0], [0, 30872], [-146315, 0], [0, 10724], [-158690, 0], [0, -8936], [0, 40116], [129395, 0], [183463, 0], [0, 396], [0, 13692], [202975, 0], [0, -59712], [0, 32264], [0, -36556], [-219566, 0], [0, -37580], [0, -21296], [281878, 0], [0, -17344], [0, -72236], [0, 14616], [104168, 0], [0, -76816]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_675_a_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_675_4_a_n();".
// 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_675_4_a_n(:prec:=2)
    chi := MakeCharacter_675_a();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 4));
    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_675_4_a_n();".
// 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_675_4_a_n( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_675_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,4,sign)));
    Vf := Kernel([<2,R![-18, 0, 1]>,<7,R![11, 1]>],Snew);
    return Vf;
end function;