
// Make newform 208.10.a.c in Magma, downloaded from the LMFDB on 04 September 2025.
// To make the character of type GrpDrchElt, type "MakeCharacter_208_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_208_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_208_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
        Kf := Rationals();
    end if;
    return [Kf!elt[1] : elt in input];
end function;


// To make the character of type GrpDrchElt, type "MakeCharacter_208_a();"
function MakeCharacter_208_a()
    N := 208;
    order := 1;
    char_gens := [79, 53, 145];
    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_208_a_Hecke( : Kf := Kf)
    return MakeCharacter_208_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 := [[0], [273], [1015], [-3955], [50998], [-28561], [509757], [626574], [-653524], [-4943006], [-4071700], [2348883], [-13350960], [7834847], [39637681], [73200924], [141141614], [-132061256], [185673110], [-224452625], [-172523674], [643288156], [-720077280], [-73028106], [-15879778], [1152754052], [113891864], [-416136124], [-297357773], [-573149534], [3350944400], [-3380725069], [-65239236], [3816566675], [-5253623250], [7468674147], [2501008118], [-6367127396], [10891039416], [-3900422972], [-7763623965], [11864754816], [19037655778], [-15163984960], [-21878609511], [-240125954], [37647253051], [-49588802409], [-49560138984], [-43682750871], [45410938349], [-15293527755], [31136560818], [-114721026936], [-43494448095], [-66582414372], [43359375144], [-61156990591], [-56297647188], [106179026582], [-48720195556], [-195096622585], [-219415665770], [53719281978], [275468090759], [-142713423570], [175507693420], [-430700479537], [-45647395005], [74244215935], [-528812234764], [-129531211344], [-426365867090], [72660152396], [-33934209424], [241078033911], [301320627378], [841445920202], [-299661013128], [-100236761852], [-85243804071], [-468175712909], [-560477685411], [710330843983], [58677393010], [895095748341], [715233774326], [354037891114], [880144006155], [-827555574856], [-577865384740], [735347039505], [1197421947448], [-288203452721], [-586544701840], [-1123882400486], [-2437864535326], [-890969714817], [-625162613820], [-3669325722271], [584419391657], [378849018561], [-3415639002025], [-1455151989937], [-2052195919227], [-4212313293006], [2687702105300], [665599381786], [3389206810150], [316186612045], [-5153524746162], [-5317188343942], [-3652669498048], [-348471577996], [-1689363233305], [5118121863038], [1433411224966], [-2243493107966], [4703518436472], [-829484296020], [-792098057578], [5562342722005], [220470287004], [3698790056020], [5403542089496], [-9916763532828], [9839896333670], [8290645811570], [7626230774810], [1201905983981], [-8419890147156], [-7663003126283], [5774871308472], [3743118302292], [-10052279593578], [2838290333280], [-10926181316717], [-11591804115824], [1281487918422], [12719938310703], [-14330220836492], [-1402248446609], [-17709011102514], [8466139266534], [21081771560650], [-12913639634320], [-9788964179495], [116791842254], [16922359644508], [23560449423745], [10813660623345], [30046336537749], [-22029596020435], [190824704104], [-22095024058581], [2549836724226], [32935022679432], [479945702412], [23383522059318], [16371188697233], [36289436460102], [25457852935447], [782018036539], [-42795171069027], [-42308013518766], [-18791646902899], [-29191357838454], [-11944086420634], [-46876898324830], [-18283145503286], [26958507534750], [32831481068709], [32292135083440], [13187184837448], [21445899140586], [48354067630031], [19047770394700], [21757437947486], [73010986893548], [10606743004964], [-62770212988992], [-58154259437660], [29843314872262], [51315156491530], [-18809584577876], [-34283122431682], [-48022087827794], [72189734818794], [-23711649707476], [36487434929616], [65426253779989], [94779811049652], [-18812359695799], [-94766410363874], [45262960183525], [80122955286162], [-9812876688688], [-9139436816864], [79064722785604], [-123790451955734], [114328168032159], [96599580137860], [-147014535594199], [20481247962769], [65420603721016], [34659191260194], [-57590378589661], [76219134363516], [-43542844739670], [-114808418233359], [-151456228271002], [180305542344522], [149732540446156], [134526349043674], [-98180039659941], [196307918069416], [-119002504479340], [-104082608908787], [97515505138540], [175574043758889], [-83895756523772], [173490858169003], [-21332420817516], [150793104048875], [165580261820865], [-242108711763694], [43629814585591], [84605814745656], [-23458586928730], [-178708460555178], [327071853044782], [37728603866108], [21307081149888], [73512046404179], [-233120764787051], [-90834876974563], [-370619971981874], [332245500153869], [172984518430032], [-12417539641342], [5539335775530], [332293997800487], [84553074825432], [256307427963545], [413478034047118], [128640908239776], [282406884007447], [-173481990207260], [-43148289208142], [-4858974670494], [-417721943579893], [-224908857424310], [-342540922135313], [-88427223013201], [-174047840199772], [239489180726098], [-317322697626228], [289483238541166], [528578837371920], [-338096475015518], [126801530900660], [200528807492979], [-373109747814523], [-596529947922506], [-46272383938392], [-305557534268821], [-366076416057253], [-412395664973756], [253917757918932], [489186174341628], [240195317505016], [-410757468701962], [264752903456754], [297521269844092], [112869281134862], [-301061952975624], [364473092411630], [714023295344706], [236819062922692], [115797667300497], [150745759457216], [316273020068055], [96788770886258], [824086481481902], [293054700095244], [509791399762450], [721511811818969], [951849285096973], [-238620000037091], [-568964808134438], [643785917194716], [841844179777871], [-1027714234874856], [-810589561024954], [336976205311894], [-522263913344628], [286625140124814], [1189469288007076], [486939708244153], [1065267046804198], [-902677813903969], [-566238553082333], [-1066028151264438], [617260230366404], [-419122162126735], [292302177136328], [1502136362577271], [1232366370232236], [-352476978859460], [-790110315179676], [997249379525568], [-764508148361915], [-52562364461409], [814188501309548], [53774925102611], [-612155089221691], [289459355771166], [235713686316872], [380533324520552], [-240838044819050], [-1407522957938636], [-1619382645021632], [-71366173588368], [1632456215526919], [-1405476347921360], [125201462770786], [-1090347378698818], [552884666469744], [167584246120720], [852588994780060], [-450510225689846], [1665118961669392], [1842168161039332], [793388912515896], [1962107566142560], [-1269132742134376], [1499274586992098], [-770033813428796], [-938333785041072], [-1094146979769578], [1176843173837199], [1663124950822875], [-382727194533145], [1884614849966210], [1006805333043829], [-441174611877821], [499412800579390], [2087973983149360], [676066652451875], [-1273464033548058], [1273041464126294], [2167175613861502], [-260559228732273], [-810732455684624], [2262377051385234], [-3145127452088214], [-2888537855662017], [-1115447758483962], [1226384199875019], [-927977070340605], [-522075392707610], [632672716403430], [-2708877127309150], [63946839253004], [-2602019712068108], [-2331918883232831], [1583405337132453], [-1006553292952096], [-2924047704060399], [-2915765048249343], [-1011201910461631], [-914854057562059], [-2055285533742546], [795943665495576], [703773999777438], [-637360055408022], [-4465329138207198], [1398058061983724], [-4695503123114294], [815899804289926], [-2633000376805902], [1786947430671958], [-4887607454908548], [3474297972713954], [4571587060599560], [-2627684855691735], [4310082617981289], [5191521280665632], [1064552787665194], [-679114806372604], [-1151082665056374], [892314385203533], [-1394610379148514], [3611583734622307], [2639372758863045], [2401656794980345], [-5205392846375649], [-2161372167620099], [-2942202784611780], [-743983864470309], [-5564196670561661], [-2446075092849422], [-3510953972396161], [-1304121910387000], [-5184741247513515], [3024490465103554], [-2012928870124271], [966284372087688], [569511301195718], [2401207733588832], [3757575182712601], [2574940798138926], [1134267976365173], [-2981428030467241], [302306742598265], [-6040404052495812], [-628937358075261], [-680479906774744], [43737734191722], [6459564126351390], [2896146256182628], [763866799629742], [-6709781430614976], [1691467604003697], [4225306115725604], [4116283029165134], [-4269799649146813], [-5839522897193400], [6197963021479112], [-3417824274381866]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_208_a_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_208_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_208_10_a_c(:prec:=1)
    chi := MakeCharacter_208_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_208_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_208_10_a_c( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_208_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,10,sign)));
    Vf := Kernel([<3,R![-273, 1]>],Snew);
    return Vf;
end function;