
// Make newform 7605.2.a.bu in Magma, downloaded from the LMFDB on 30 September 2025.
// To make the character of type GrpDrchElt, type "MakeCharacter_7605_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_7605_2_a_bu();".
// 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_7605_2_a_bu();".
// 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 := [1, -3, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0], [0, 1, 0], [-2, -1, 1]];
    Rf_basisdens := [1, 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_7605_a();"
function MakeCharacter_7605_a()
    N := 7605;
    order := 1;
    char_gens := [6761, 1522, 6931];
    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_7605_a_Hecke( : Kf := Kf)
    return MakeCharacter_7605_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 := 2;
    raw_aps := [[0, 0, 1], [0, 0, 0], [1, 0, 0], [-1, -2, 1], [-2, 2, 2], [0, 0, 0], [2, -2, -1], [-1, 3, -1], [-2, -2, -4], [-3, 3, 0], [-4, 3, 1], [-6, 4, 0], [7, -1, -2], [-6, 3, 2], [0, 0, 1], [4, 4, 2], [-3, -1, -6], [4, -3, -1], [-2, -5, 0], [-1, -1, 2], [-5, 0, -1], [6, -1, -3], [0, -2, 0], [7, 1, -4], [2, -7, -2], [-6, -2, -4], [-4, 5, 0], [-2, -6, -1], [5, 4, 4], [2, 0, 2], [5, -4, -7], [-3, -5, 4], [12, -2, 3], [1, 4, 6], [2, 0, 0], [-7, 1, -7], [2, -1, 2], [-13, -2, 5], [6, -2, 6], [4, 6, 1], [-9, 5, -6], [5, -5, -3], [-3, 1, 6], [1, -8, 1], [0, -10, 6], [-1, 6, -2], [1, -6, -4], [-10, 2, 0], [-16, -2, -1], [-11, -1, 3], [-6, 2, 10], [0, -10, -10], [-9, -3, -15], [16, 6, -4], [16, -6, 1], [4, 0, 9], [-11, -5, -10], [3, 6, -4], [8, -2, -2], [1, 3, -4], [-15, 12, 9], [-10, 6, -1], [-6, -5, -10], [-5, 1, 6], [4, -3, 4], [4, -14, 2], [-3, 4, -2], [-18, -7, 4], [-20, 16, 6], [-8, 1, 11], [12, 8, 0], [5, 5, -8], [-2, -15, -2], [5, -4, -11], [0, 1, 9], [2, -8, -9], [6, 4, 2], [-6, 7, 4], [-18, -2, -8], [-26, -3, 3], [-5, -15, 6], [-26, 5, 3], [-12, -2, 2], [-1, 2, 1], [-10, -5, 1], [2, 14, 5], [-8, 2, -8], [-18, 9, 2], [3, 9, 14], [24, -13, -4], [8, 0, -11], [-5, -3, 0], [-1, 9, 3], [23, -3, 10], [19, -17, -11], [12, -10, 10], [12, -4, -8], [-13, 1, 2], [2, -6, 0], [-3, -4, 10], [6, 9, 4], [2, 4, 20], [-6, 8, 8], [-11, -3, 2], [-1, 3, 17], [-6, 0, -22], [-20, 12, -3], [20, -14, -4], [-3, -7, -10], [-7, 3, 7], [-25, 9, -1], [14, -9, 0], [12, -12, 4], [-9, 18, 4], [22, -17, -9], [4, -16, -10], [5, 16, -1], [14, 10, 12], [16, 4, 17], [-14, 18, 12], [-27, 10, -2], [7, 2, -3], [22, -4, -6], [-22, 12, 5], [-12, -1, -7], [-12, -12, -6], [-17, 10, -6], [1, -1, 20], [-8, -11, -20], [0, -1, -8], [14, -22, -16], [6, 8, -11], [15, -1, 1], [-13, 19, -1], [-6, 4, -4], [-19, -1, 13], [-22, -2, -2], [-3, 8, 13], [-12, 2, 7], [14, 18, -4], [-23, -8, -4], [-8, 10, -18], [6, -2, -6], [-26, 8, -1], [-14, 29, 1], [-18, 6, -8], [-17, 2, 3], [-6, 2, 19], [-20, -15, 11], [24, -14, -8], [10, -8, -6], [0, 4, 14], [4, -1, 20], [-24, 14, 13], [-23, -9, -7], [6, 14, 8], [-5, -17, -5], [22, -22, -6], [0, -26, 6], [17, -17, -12], [-4, 24, 5], [-2, 14, -14], [-20, 4, 10], [-4, -2, -4], [-10, -14, -24], [0, -12, 8], [7, -9, 7], [3, -6, 25], [8, 7, 9], [-14, 8, 7], [-53, -1, -2], [-7, 19, -7], [-2, -14, 2], [-3, 10, 27], [23, -13, -7], [19, -1, 4], [-45, -4, 2], [28, 6, 2], [-6, -27, 12], [11, 20, 8], [4, 0, 26], [-11, -11, 6], [-12, 27, 8], [6, 10, 7], [-22, -16, 1], [6, 14, 16], [-27, 6, -7], [-10, 10, 12], [-20, 7, 9], [-19, -7, 2], [-1, 20, 1], [-6, 0, -7], [-6, -17, -17], [19, 5, -12], [44, 8, -9], [4, -20, -20], [-6, 7, -9], [-16, 7, -4], [-8, 22, -9], [2, 24, 13], [33, -13, -2], [16, -5, 17], [20, -21, -18], [22, -3, -3], [2, 0, 12], [18, 8, 17], [5, 22, -4], [22, 0, 4], [0, 18, 16], [26, -30, -8], [17, -8, -9], [2, 22, -10], [14, 7, -8], [20, 10, 33], [-10, 12, 0], [23, -15, -11], [-29, -4, 15], [48, -2, 0], [-2, 20, -11], [-18, 18, -3], [-18, -7, -13], [14, -17, -15], [22, 4, 22], [14, -29, 0], [-10, 4, -2], [-11, 30, 6], [-6, -10, 0], [24, 8, -14], [-13, -18, -7], [9, -19, -2], [27, 4, 15], [40, -7, 3], [4, -20, -16], [-1, 15, -8], [-23, 20, 13], [-4, -10, -4], [-34, -15, -5], [18, -14, 9], [-1, -27, -6], [6, 18, -22], [6, -18, -20], [-29, 3, 9], [-34, 18, 16], [34, 3, 21], [-10, 24, 16], [-26, 6, -4], [-6, 13, 22], [-16, 2, -10], [34, -17, -1], [14, 14, -18], [-1, 16, 35], [-13, 3, 10], [0, -18, -31], [-14, -19, -11], [40, -12, 3], [-45, 9, 12], [-5, 9, -3], [-33, -7, -33], [14, 0, 1], [1, 13, -19], [6, 14, 16], [10, -18, -13], [3, -38, 10], [41, 12, 19], [26, 14, -1], [-47, 26, 4], [-17, 5, 0], [3, 1, -8], [-10, 10, 32], [-14, -20, -16], [33, -6, 4], [24, 11, 0], [-6, 12, -6], [7, -25, -29], [-39, 2, 3], [2, 6, 30], [-36, -6, -2], [34, -20, -22], [3, 12, 28], [-20, 10, -16], [-16, -22, 5], [12, -28, -16], [-10, -10, 18], [11, 20, 30], [28, -16, -18], [-36, 2, -14], [4, -1, 12], [2, -26, -9], [-3, 12, -16], [-17, -7, -18], [-15, -9, 8], [2, -16, 1], [4, 8, 26], [-66, 4, 4], [-11, 24, 1], [-27, 39, 18], [10, -18, 8], [-22, -18, -32], [36, -26, 0], [13, -12, -15], [26, -9, -22], [16, 16, -5], [40, 16, -16], [12, -12, -5], [-38, -13, -5], [-37, -20, 5], [-34, 10, -12], [-2, -20, -26], [-65, -9, -6], [-24, -10, -30], [-54, -4, -5], [-38, 20, -8], [-43, -15, 6], [5, -14, -9], [50, -22, -13], [-5, -26, -8], [31, -23, -14], [-10, 14, -10], [2, 17, 20], [31, 19, 18], [2, -7, -29], [15, 6, -17], [-5, 15, 6], [-22, 25, -14], [10, -18, -14], [14, -15, 25], [37, 8, 12], [0, -28, -22], [-8, 12, 1], [22, -6, -29], [29, -1, 31], [-24, 28, -15], [9, -12, 24], [40, -4, -23], [-10, 9, 5], [-24, 22, -12], [-6, 31, -7], [-24, -6, -22], [-10, 8, 2], [6, 5, 8], [9, 1, 13], [6, -8, 10], [-3, 3, 36], [15, 16, -14], [-40, 2, 15], [20, 28, 14], [-20, -5, 15], [24, 20, -14], [47, -5, 4], [-8, 0, 10], [-25, 24, 6], [40, 6, -16], [-42, 52, 26], [-16, -19, -32], [5, -9, 3], [0, 0, 18], [-49, 29, 18], [-27, 5, 4], [40, -6, 18], [-22, 18, 16], [-38, 0, 22], [36, -12, 12], [-50, -18, -16], [13, -7, 28], [-19, -10, 3], [7, -26, -23], [-8, 36, 15], [-5, 24, 29], [-61, 41, 21], [-1, -31, -44], [55, -6, 2], [-64, -12, 0], [12, 22, 20], [-3, 37, 17], [-1, 7, 19], [-53, 3, -20], [58, 0, -10], [-48, -15, -14], [-7, 9, -38], [50, -27, -22], [-8, 10, 20], [-70, 2, 1], [-66, 22, 18], [-50, 16, 3], [-41, -6, 20], [22, -2, -3], [23, -33, -25], [-48, 35, 10], [19, -2, -7], [-52, -2, 0], [53, -25, -7], [40, -40, -29], [-26, -4, -36], [53, 15, -7], [-35, 41, 18], [17, -46, -7], [-51, 29, 23], [-19, -23, 10], [3, 27, 17], [3, 9, -10], [-32, -11, 15], [-30, -28, 25], [-34, 25, -8], [-40, -12, 13], [57, -31, -10], [5, -12, -42], [22, 1, -22], [35, 31, -10], [-24, -31, 0], [-4, -34, -26], [-37, -14, -9], [-6, 22, 13], [-2, -14, 11], [12, 16, -12], [8, -33, -8], [21, -35, 18], [46, -42, -14], [7, -8, -37], [-20, 52, 11], [26, 6, -9], [17, -15, -18], [-27, -16, 11], [20, -24, -23], [16, 16, -6], [3, -22, 1], [18, -12, -25], [56, 10, 19], [44, 2, -10], [25, -8, -34], [44, 24, -8]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_7605_a_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


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