
// Make newform 507.2.p.a in Magma, downloaded from the LMFDB on 19 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_507_p();"
// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_507_2_p_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".
// To make the character of type GrpDrchElt, type "MakeCharacter_507_p();"
function MakeCharacter_507_p()
    N := 507;
    order := 26;
    char_gens := [170, 340];
    v := [26, 3];
    // 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_507_p_Hecke(Kf)
    return MakeCharacter_507_p();
end function;


// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_507_2_p_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_507_2_p_a( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_507_p();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,2,sign)));
    Vf := Kernel([<2,R![455625, -528737625, 182488358700, -5294728325835, -105610025885967, 1660495902731016, 58853912960640386, 257722787941797464, -5026477345264492987, -80913950187914283388, -416438850581543644322, 1220191458874880517285, 36067802821025704499509, 309773972203683840191313, 1733659113734720705493191, 7376634805708703297714302, 25923847568657687369982457, 79202866398974368243251994, 214918196447891214044065760, 515419852048566533918102331, 1084597389202875424497853183, 1991090337092459161133920735, 3212476110925558009674855398, 4473377873186931013286876674, 5332889714986303766939575457, 4181995557884474707647131160, 2414342217690842941525187119, 2872493912740919012703070537, 7444538629311521972583830979, 13363679265341952611569417029, 28376677685330962063929217088, 54579881597215221407465549231, 44729823322758330658150695327, -63080979015215878553826270385, -1789342453060929995617885280, 343329035090040741328374838115, 195691943263145248656385800666, -564890974784697430256823181707, -475083379501597071584235695092, 169574662821492094299995287140, 521396609523449049547343852814, 1369805829787420290499084848361, 1408085789066516834331400103991, -870659624403414661005602821760, -4898098532307802504267297687026, -8688590567005243275541066070645, 394812403399097242958472847131, 22024229748590188107946484376746, 19095682816976858369331462599858, -13692781025042359236440916669626, -30228634223802255298737020037650, -16594797186227090544363574252458, 4049537711295607754943297812615, 18336279653154910900066673410611, 26233521055144839469258232258747, 23721995596455009851464329976126, -6476261840609730059281265458344, -48927315237620002209825708994019, -30907059573933549381792636530184, 48699334884285598787800331335361, 57408280680371736431747877735129, -37010127194118680235459112518439, -65960812453331446777729325785735, 22184722711806180710804158847906, 57883155325595189191561711676570, -12943610896018270010906885002728, -43846047496632741804414014342747, 8544614031499653538230903089233, 29946534803257649532198991604602, -6345875490217586053001486935876, -18858999681417676104775199313209, 5058484095960740216099849485016, 11368928337172198376350280083158, -3709599877362047278290074581434, -6421136240391645104874268288262, 2515190701335287784370016047775, 3413021682108974967345551081916, -1577860663189299091355094681443, -1720419795657799583973039949144, 916939271540699637493751336758, 835996024174127838681060661942, -484148000518911456847825713176, -390158009949386451485701743323, 231430413389466903589843910954, 174613835454813263987498614278, -101256171517540431690205973312, -74603257794303445632429987424, 40899539800579904746861840788, 30601469858671638656384628772, -15295886490959825515779564615, -12209304112670466866623832823, 5202235860067331499224985980, 4630693299803301598909082351, -1579631216225897535840036417, -1685689875158943333678696383, 440624094457732297239287719, 597200265163324349747428570, -114303213948785294122810445, -196834964516402638976095622, 25617560658549062958406119, 62470883165560407564285822, -5858795978757756275561294, -18676102656325281495049111, 1236293600396989281246073, 5193413413085259374920527, -192070763998034495626585, -1381297846500688632885023, 2615447908853947480053, 364104489063240292139342, 7601027218464052251606, -93567287683475680835918, -2613317979685419923709, 23276223529189577259493, 893194393341951612522, -5638815289960491079725, -309551533857361920579, 1367448327014262464782, 100124315545596518826, -330273034462923581348, -24836514652367947191, 76942261350874120464, 5839888290731650870, -16894750917244076566, -1471839151813203524, 3639737990316724252, 368042627618609567, -767162789392418371, -86061327423795269, 157237590088846703, 19134248154440471, -31706289715127230, -3926737615187764, 6300549597614670, 740668388694780, -1229951427870020, -135732397535241, 235789681537001, 25093835258011, -44086986469842, -4562058641543, 7878099751003, 792267957273, -1308885029675, -132343071900, 199273899306, 22286706130, -28178403612, -3737144268, 3896062318, 591325579, -535224805, -84939725, 73367358, 11021595, -10057580, -1236612, 1336360, 113477, -169988, -9035, 20696, 650, -2380, -26, 248, 0, -20, 0, 1]>],Snew);
    return Vf;
end function;