
// Make newform 160.6.n.d in Magma, downloaded from the LMFDB on 19 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_160_n();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_160_n_Hecke();"
// To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
// To make the newform (type ModFrm), type "MakeNewformModFrm_160_6_n_d();".
// 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_160_6_n_d();".
// 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 := [177426662425600, 0, 124211190826240, 0, 24971013117824, 0, 1612811892960, 0, 26872635188, 0, 198706725, 0, 743087, 0, 1375, 0, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [344, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [192797603188806497285044480, 250967095756936052654361600, -90565141677532700310107904, 0, -3863833615055145620098720, 0, -97152181490387236940048, 0, -1095404202095902328315, 0, -5682876639346407577, 0, -13462238412424545, 0, -11825110207571, 0], [-192797603188806497285044480, 250967095756936052654361600, 90565141677532700310107904, 0, 3863833615055145620098720, 0, 97152181490387236940048, 0, 1095404202095902328315, 0, 5682876639346407577, 0, 13462238412424545, 0, 11825110207571, 0], [0, -375523742774793743806881372849920, 0, -51612542386876249198327508150784, 0, -3079764569891573188210805156320, 0, -50443590459859677634015726208, 0, -368975242720366525158266015, 0, -1366856259525550450056517, 0, -2507428535219858004045, 0, -1809265083797853191], [-28406264753768725158262487417131223040, 7252751816283467948283657920432480000, -8575998357382048756480267774157488128, 1337439695782314706831377434958435840, -525059848586542496097907220140069632, 37621430170979065387980115262923360, -8847276528455532184796971776315648, 422523400440708528419984044413440, -66846944600066252228480518367016, 2382683421778575594622394461535, -255630176344657651316440839480, 7181471713121377381025820805, -482670369734028581607211512, 11069663104785560762888205, -357160040187741313248744, 6866491718161395654215], [-46105215415558292909748531709950688000, -4760879288961951811568777115417725440, -16549633481524140545409058429582560000, -3035550493668873995221264014465938688, -1244997230111161319225858276149460960, -297055660930670388616016050438768640, -20901956176766407775973408000092560, -5307342048213973955400487699674256, -153058646547256176809809554141055, -40353954066126661086707554864030, -564854508488341556707132675205, -153170559163306533776502016394, -1031560391502649444168357485, -286043970181866816148154490, -741346810976606855671735, -209327337896720985272062], [0, -2677877995500129055861418807087360, 0, -376172919280776681615944469343872, 0, -22339702761128737788859802402560, 0, -368252411846707879595859317864, 0, -2720317152186531734246366495, 0, -10190057495851634706399061, 0, -18903858510802945525485, 0, -13786776642126692303], [162898518527008571254695132123907840000, -320162774036370633932346284711432554240, 96355859443289580502536525344533862400, -110751042411755592831773947038496731648, 9593101269677398501445426829725830400, -8433714694702808252345052999497226080, 172444016423960177949639540169686400, -145074447379058264406100225288974016, 1318968915222404228685090058103800, -1087637854469202150607351480284775, 5035721941230776321519622242600, -4099674884947829019891416053469, 9454189467790666483460221800, -7625418617428332303133060005, 6949993378049009250268600, -5566030922688749413826767], [4203497709483160576693597263645374720000, -320162774036370633932346284711432554240, 2013355140513755923529795131718574028800, -110751042411755592831773947038496731648, 180498189527416756265377722079928592640, -8433714694702808252345052999497226080, 3222467580535314009492312498986541440, -145074447379058264406100225288974016, 24648921203858780705158533243854120, -1087637854469202150607351480284775, 94154885188786872835078731102520, -4099674884947829019891416053469, 176798565520881529360299957240, -7625418617428332303133060005, 129960784401954325696571240, -5566030922688749413826767], [-69514540717049323591877386739069177600, -157784909768458858465274909327895514880, -1302120321698109857341036398996875520, -48497009422040773878381831358908312576, 1538993332620586742182243359654231200, -3328783170463780051079137409741191840, 28403203012303361198356605999937360, -55887717743262687591401379809883872, 204007403196789880601496641237725, -413819805756243057364906486201715, 716729967756964301482446240815, -1547268276216688908386335994593, 1234862806282864864307027175, -2861346117069557180903000265, 836388425799336388655845, -2079571546896262521247259], [-3317521997018119743579375525286156364800, 228251347352231206710533476409740655360, -1192538232033475454671652345441193077760, 146036589129754799136742373764005622272, -89680954773495608125692526085405025920, 14278372978625775047253754941645873760, -1505975625527646481662813106064645440, 255075105962442472217048208184916864, -11031889847182002812634426489352060, 1939350129801761916823400061171395, -40730053685727891104727602901140, 7360930619330898567501108326161, -74415736279191468356635751220, 13746150589069408606763291385, -53502921211166683323853660, 10059286087783662159921803], [326106822553214887460081107968884646400, 959151780158875483885088631498082110720, 193194029568447828706173119944692103680, 332253127235266778495321841115490194944, 19206779642100793573606218760773579200, 25301144084108424757035158998491678240, 345405423248152916795642945368363360, 435223342137174793218300675866922048, 2643771478334587498534249411805650, 3262913563407606451822054440854325, 10101708419745202153946269628390, 12299024654843487059674248160407, 18980072981081687155177449750, 22876255852284996909399180015, 13962962166523513358281570, 16698092768066248241480301], [-1316353072736239532499194100281797024000, -589620218741168295803535845488408674560, -478464378849738436250481807957043603200, -201030096523050442054663505178221747712, -40448657442620979006937806139761024800, -16392549780658167559623183645155751040, -709839207381230422275282966418454800, -284771130354851777238186583291599824, -5367960507885800472078184654518625, -2140831477545044440693862557129835, -20336209317468904804371394893275, -8076208774652308679760120740521, -37959276386532472305450849075, -15024376130354477310729600465, -27783907427930568027457225, -10965954420342237453919043], [138315646246674878729245595129852064000, 484610876662767905038730724409026503680, 49648900444572421636227175288747680000, 223593558714793247690159589584585953536, 3734991690333483957677574828448382880, 19448706675108969250079166765944355200, 62705868530299223327920224000277680, 340123519656256437163682824971661552, 459175939641768530429428662423165, 2557972420577442815950255557487420, 1694563525465024670121398025615, 9637502302230152435210878211828, 3094681174507948332505072455, 17897683722788983045804662900, 2224040432929820567015205, 13040108694184093526903884], [-2079443560485779550081405820044185792000, 1499403211518707225539417975688249903360, -758333155921187185956054914759096486400, 512811235457856476941100957394940227072, -65957348123908022183165312965728518080, 41218814256019143371591420289808728160, -1168854940641263951238885036835798880, 714616708088761818882473391872173664, -8899217257204526822438654659344590, 5369300809559291031995076594544445, -33894164533077710928257197684090, 20252092434252446379411657534511, -63539828075033151280881408330, 37674170878137286924592260935, -46671653124141853786853630, 27497939763373224321664853]];
    Rf_basisdens := [1, 1, 250967095756936052654361600, 250967095756936052654361600, 417865233777213666390565151232000, 76373825727795309254298436355174400, 222756991706069651991703772702592000, 8705525703691951383136773984000, 2673083900472835823900445272431104000, 2673083900472835823900445272431104000, 668270975118208955975111318107776000, 2673083900472835823900445272431104000, 1336541950236417911950222636215552000, 668270975118208955975111318107776000, 668270975118208955975111318107776000, 1336541950236417911950222636215552000];
    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_160_n();"
function MakeCharacter_160_n()
    N := 160;
    order := 4;
    char_gens := [31, 101, 97];
    v := [2, 4, 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;

// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_160_n_Hecke();"
function MakeCharacter_160_n_Hecke(Kf)
    N := 160;
    order := 4;
    char_gens := [31, 101, 97];
    char_values := [[-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]];
    assert UnitGenerators(DirichletGroup(N)) eq char_gens;
    values := ConvertToHeckeField(char_values : pass_field := true, Kf := Kf); // the value of chi on the gens as elements in the Hecke field
    F := Universe(values);// the Hecke field
    chi := DirichletCharacterFromValuesOnUnitGenerators(DirichletGroup(N,F),values);
    return chi;
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+1)]];
    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 := 6;
    raw_aps := [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-3, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0], [-6, 0, -1, 0, 6, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0, 0], [0, 0, 2, 2, 26, 0, -1, 0, 0, 0, 0, 0, 0, 0, -1, 0], [35, 0, 2, 0, -35, 0, -1, 0, 2, 0, -1, 0, 0, 1, 0, 0], [-116, 1, 0, -1, -115, -3, 1, 1, -6, 0, 0, 1, 0, 0, 0, -1], [163, -2, 8, -10, -1, 3, -7, 0, -6, -1, 3, -1, -1, 1, 0, 1], [-484, 4, -4, 21, -488, -11, -8, 4, -3, -1, 0, 0, -4, 0, 1, 0], [1, 0, 15, 23, 553, -16, -30, -6, -12, 0, 16, 7, -1, 0, -4, 0], [11, 0, 30, 40, 869, 10, -6, -10, 54, 0, -10, -1, -11, 1, 0, -1], [-413, 6, -5, -234, -404, -12, -19, 6, -67, -4, 0, 14, -5, 0, 4, 4], [-1519, -5, -201, 219, 19, 41, 35, 0, -41, -16, 41, 19, -1, -5, 0, -5], [1243, -18, -10, 111, 1221, -32, -8, -18, 48, 0, 0, -12, -10, 0, 0, -2], [1376, -14, -451, 2, -1334, 0, 187, 14, -30, -1, 11, 2, -40, 10, -1, 0], [554, 6, -689, 33, -514, 0, 19, -6, 100, 16, 41, 33, -7, -1, 16, 0], [-8813, 78, 136, -170, -29, -7, -109, 0, -28, 15, -7, -29, -5, 5, 0, 5], [-1476, -18, -234, 259, 37, -103, 251, 0, 29, 0, -103, 37, -12, -1, 0, -1], [-1199, -4, -1421, -44, 1127, 0, -110, 4, -168, -14, -10, -44, 28, 0, -14, 0], [87, 0, 774, 904, 2473, -58, -202, 30, 290, 0, 58, 43, -87, 1, 0, -1], [695, 40, -733, -2, -698, 0, -40, -40, 25, 4, 3, -2, 1, 41, 4, 0], [-9599, 30, 699, -749, 41, -83, 247, 0, -393, 0, -83, 41, -91, 35, 0, 35], [-4229, -44, 124, 1325, -4157, 230, 441, -44, 383, 1, 0, -52, 124, 0, -1, 0], [-48, 0, -496, -602, -7226, 190, 66, -14, -2, 0, -190, -58, 48, 6, -80, -6], [-676, 86, -18, -521, -781, -21, 83, 86, 482, -64, 0, -87, -18, 0, 64, 1], [-27398, -62, 468, -500, -116, -112, -352, 0, 596, -60, -112, -116, 84, -40, 0, -40], [-13060, -90, -2, 1593, -12962, 291, -376, -90, -477, -95, 0, 100, -2, 0, 95, -70], [2849, 58, -2281, -54, -3191, 0, -1376, -58, 230, 80, -222, -54, 288, 70, 80, 0], [32, 0, 3466, 3357, -16841, 73, 907, -144, 201, 0, -73, -141, -32, -39, 56, 39], [33947, -109, 1138, -102, -34071, 0, 148, 109, -584, 40, -60, -102, 22, -116, 40, 0], [20048, 248, -1413, 64, -20052, 0, -648, -248, 377, -80, 255, 64, 68, 164, -80, 0], [-287, 0, 57, -213, 81289, -27, 232, -130, -1175, 0, 27, 17, 287, -41, 225, 41], [49053, -192, 230, 6332, 49063, 64, 1358, -192, 1382, -76, 0, -220, 230, 0, 76, -24], [-21414, -148, -1003, 1095, -138, 460, -1012, 0, 973, 319, 460, -138, 230, 186, 0, 186], [-335, 0, 6519, 6038, -84908, -222, 718, -122, -1562, 0, 222, -146, 335, 146, -88, -146], [-38, 0, -2095, -2123, 150294, 183, -339, 396, 31, 0, -183, 10, 38, 34, -28, -34], [88350, -292, -206, -4811, 88293, -1540, 217, -292, -1095, 20, 0, 149, -206, 0, -20, -124], [-116831, -124, -124, -6505, -117051, 292, -1132, -124, 40, 96, 0, -96, -124, 0, -96, -220], [143230, -90, 8197, 110, -142964, 0, 1005, 90, -430, 225, 489, 110, -156, -110, 225, 0], [90826, 476, -238, 521, -90127, 0, 759, -476, 3699, 204, -1662, 521, -178, -186, 204, 0], [-178886, 372, -3113, 2797, 342, -848, 2216, 0, -2713, -559, -848, 342, -658, -86, 0, -86], [-128781, -1218, 12551, -12097, 269, 1513, -437, 0, -1025, 252, 1513, 269, 185, -185, 0, -185], [152, 0, -2985, -2961, 377808, -11, 507, 344, 597, 0, 11, -128, -152, 216, 160, -216], [172991, -121, 16473, 750, -171676, 0, 1626, 121, 1383, -400, 2251, 750, -565, 49, -400, 0], [59486, 186, 639, 3121, 60428, 1441, 2054, 186, -273, -684, 0, 303, 639, 0, 684, -81], [-241153, -510, -5517, 5055, -481, -2065, 141, 0, 1839, 190, -2065, -481, 19, -75, 0, -75], [1341, 0, -2725, -1427, 195537, -505, 616, 526, 4859, 0, 505, -43, -1341, -5, -157, 5], [-161508, 738, 490, -11861, -161738, 1919, 709, 738, 3548, 308, 0, -720, 490, 0, -308, -234], [-122499, 942, 3437, 1022, 125017, 0, 6133, -942, 4689, 157, -750, 1022, -1496, 482, 157, 0], [-268, 0, 106, -370, -139936, 2347, -989, -2094, 1275, 0, -2347, -208, 268, 43, 196, -43], [221553, 675, 11269, -16, -222832, 0, -6160, -675, -31, 148, 1075, -16, 1263, 9, 148, 0], [-238557, -2374, 6843, -6497, -161, 1713, -2357, 0, 2721, -638, 1713, -161, 507, 377, 0, 377], [-496663, -625, -697, -21, 579, 1489, 827, 0, -9305, 264, 1489, 579, -1297, 115, 0, 115], [1146, 0, -10982, -8154, 180556, 188, -9747, 420, 4772, 0, -188, 1682, -1146, -10, 513, 10], [-43641, 1927, 18, 6278, -42813, -600, -176, 1927, -4088, -200, 0, 810, 18, 0, 200, -256], [-184362, 1232, 832, 13379, -182938, -369, 3747, 1232, -2318, 510, 0, 592, 832, 0, -510, 320], [-330, 0, -6612, -6553, -297427, -3777, 981, -502, -5097, 0, 3777, 389, 330, 423, 384, -423], [-1659, 0, 24210, 22000, 914375, 3166, 1396, 786, -3470, 0, -3166, -551, 1659, -373, 510, 373], [112480, 1822, 1030, -4193, 112085, -4732, 9271, 1822, 6119, 1592, 0, -1425, 1030, 0, -1592, -444], [-577377, -763, -1115, 2915, -1457, 2841, -8669, 0, 17563, -728, 2841, -1457, 3257, 67, 0, 67], [-498139, -1382, 442, 10133, -498321, 150, 3021, -1382, 3899, -627, 0, -624, 442, 0, 627, -290], [277613, 300, 9101, -2154, -283248, 0, -15885, -300, -5041, -268, -1614, -2154, 3481, 366, -268, 0], [-454289, -1062, -59609, -1086, 451687, 0, -6158, 1062, -14906, -254, 10656, -1086, 1516, -590, -254, 0], [-1100, 0, 9989, 10973, 885768, -2229, -11937, 3208, -6629, 0, 2229, 2084, 1100, 988, 314, -988], [240153, -77, -23140, -2504, -244317, 0, -6114, 77, -7244, -1500, -3298, -2504, 1660, -1182, -1500, 0], [432305, -1852, 386, -29280, 432673, 4021, -2018, -1852, 531, 372, 0, -18, 386, 0, -372, 427], [-1623, 0, 9603, 5509, -185459, 9935, 6128, -770, 3443, 0, -9935, -2471, 1623, -833, -429, 833], [176167, 496, -3972, -106506, 171669, -7174, -9666, 496, 1152, -1192, 0, -526, -3972, 0, 1192, 1302], [-328881, -3966, -20487, 3050, 329991, 0, -12091, 3966, 22207, 509, -5676, 3050, 1940, -150, 509, 0], [3358, 0, -31368, -27712, -412962, 1635, -7289, 1178, 15067, 0, -1635, 298, -3358, 1163, -1540, -1163], [141411, 98, -36922, 1614, -140595, 0, -7228, -98, 9980, -472, 512, 1614, 798, 1152, -472, 0], [-1143856, 2456, -19188, 19260, 2836, -506, 11850, 0, -13170, -1020, -506, 2836, -2764, 944, 0, 944], [1115884, 496, -93325, 1176, -1113848, 0, 2204, -496, 3713, -684, 2227, 1176, -860, 236, -684, 0], [-124218, 1094, 14966, -1335, 122381, 0, 3285, -1094, -16165, 3128, 5532, -1335, 502, -1332, 3128, 0], [611418, -1972, -26701, 22425, -5366, -1182, -20282, 0, 9881, -2243, -1182, -5366, 1090, -42, 0, -42], [787172, -1686, -5534, -64453, 785206, 1791, -29571, -1686, -19916, -2228, 0, 3568, -5534, 0, 2228, 1230], [-6314, 0, -56088, -62327, 459083, 1329, 667, -3658, -23927, 0, -1329, 75, 6314, -551, 1344, 551], [-85472, 174, -5543, 6651, -87554, -7641, -22414, 174, -21727, -2088, 0, 3461, -5543, 0, 2088, -967], [-31795, 4562, 37165, -33935, 4295, -9897, 27077, 0, 7205, -1288, -9897, 4295, -1065, 1205, 0, 1205], [-1659, 0, 29835, 29361, 445391, -5625, 693, -3131, -12261, 0, 5625, 1185, 1659, -333, 1512, 333], [1790382, -1972, 23297, -19541, 3742, -5518, 20486, 0, -2617, 5007, -5518, 3742, 14, -1606, 0, -1606], [-1209, 5182, -74329, 74886, 102, 890, -482, 0, 4988, -2880, 890, 102, 455, 134, 0, 134], [8885, 0, 58518, 71756, 923319, 3162, -27340, -2310, 38702, 0, -3162, 4353, -8885, -541, 858, 541], [-972629, 1698, -13291, 4502, 983880, 0, 26522, -1698, 1935, -3376, 16547, 4502, -6749, -655, -3376, 0], [-150402, -7524, -47650, 45550, 1786, -9336, 16480, 0, -12660, -836, -9336, 1786, -3886, 242, 0, 242], [-225795, -5758, 546, 7957, -221993, 8846, -14695, -5758, -21057, 2993, 0, 3256, 546, 0, -2993, -2330], [168, 0, -5902, 1952, 210210, 3410, -45506, 1071, 4082, 0, -3410, 7686, -168, -1350, 1320, 1350], [-860001, 5799, -1028, 14566, -862867, 9688, -12122, 5799, 9030, -3060, 0, -1838, -1028, 0, 3060, -2192], [1134420, -1466, -35918, 42562, 6166, 12802, 11862, 0, -9446, 1252, 12802, 6166, 478, 870, 0, 870], [1089534, 8526, -2178, -146079, 1089068, 2857, -15348, 8526, -10627, -1825, 0, 1712, -2178, 0, 1825, -1714], [-1895849, -5644, 24613, 5780, 1901853, 0, -7585, 5644, 33545, -3057, -1944, 5780, -224, -132, -3057, 0], [-35154, -76, -33240, 30812, 4090, -8740, 25100, 0, -30978, 4486, -8740, 4090, -6518, 1938, 0, 1938], [2178344, -1866, 110803, 3014, -2175286, 0, 3526, 1866, 6419, 3454, 2287, 3014, -44, -2866, 3454, 0], [289, 0, -152337, -144967, -3889067, -2461, -40968, 1206, -1305, 0, 2461, 7081, -289, -1121, -3185, 1121], [575740, 11448, -54225, 44073, -8460, 14112, -47952, 0, -24099, -3725, 14112, -8460, -1692, -1780, 0, -1780], [1993768, 4798, -2586, -32559, 1993578, -9897, -1284, 4798, -10421, -4095, 0, 2396, -2586, 0, 4095, 50], [-2978, 0, -77872, -77452, 1780330, -27781, 10487, 5606, -39693, 0, 27781, 3398, 2978, 411, 3916, -411], [2885622, -3914, 33096, -28420, -3672, -12868, -1820, 0, 46948, 7120, -12868, -3672, 8348, -4444, 0, -4444], [454457, -380, -3772, -52699, 445485, -21544, 8477, -380, 22821, 4387, 0, -5200, -3772, 0, -4387, 4980], [3369666, -2406, 69556, -79524, -2996, -18448, 6464, 0, -22220, -412, -18448, -2996, -6972, 376, 0, 376], [-2390271, -8158, -20635, -5246, 2387953, 0, 26633, 8158, -31415, 6817, -4490, -5246, -2928, 70, 6817, 0], [-1380065, 8084, 4979, 23946, -1376504, 1322, 20317, 8084, 7395, 3272, 0, -1418, 4979, 0, -3272, -1402], [-998943, 9696, 240, -284381, -984583, -10208, 170, 9696, -67478, -1474, 0, 14120, 240, 0, 1474, 1408], [-10913, 0, -128871, -143577, 3289337, 15921, 2419, -1449, -27731, 0, -15921, -3793, 10913, 4253, 4088, -4253], [2304, 0, -170714, -171802, -5132206, -32508, 55039, -6656, -23292, 0, 32508, -3392, -2304, -592, 995, 592], [-848299, -5121, 618, 94164, -850925, 2778, -2310, -5121, 10972, 200, 0, -3244, 618, 0, -200, -5666], [-3390043, -3480, 89773, 13616, 3401415, 0, -26891, 3480, 38165, -1075, 34214, 13616, 2244, 980, -1075, 0], [-3455163, 11272, 97560, -5860, 3446367, 0, 996, -11272, -27476, 6368, -8704, -5860, 2936, -3448, 6368, 0], [572973, -786, -258403, 268961, 109, 14737, -14301, 0, 29717, 7070, 14737, 109, 10449, -5585, 0, -5585], [3556817, 709, -24245, 25469, -2147, 21743, -30331, 0, 2325, -312, 21743, -2147, 3371, 1765, 0, 1765], [125304, 20934, -211907, 3302, -139698, 0, -87933, -20934, 35762, 4639, -5405, 3302, 17696, 790, 4639, 0], [-275073, -27894, 160552, -2552, 270435, 0, -7771, 27894, -40716, 68, 29935, -2552, 2086, -39, 68, 0], [-512448, 1025, 1430, 74347, -520941, -26039, 35559, 1025, 43492, 6132, 0, -9923, 1430, 0, -6132, -1421], [3507507, -7218, -124960, 110686, -4309, -25587, 8351, 0, -35272, 6359, -25587, -4309, -9965, 2645, 0, 2645], [-15448, 0, -74127, -87287, -1884436, 20855, -18581, -3384, -40937, 0, -20855, 2288, 15448, -944, 14114, 944], [2376759, 17451, -87399, 94597, 729, -17753, 20669, 0, 68825, -7704, -17753, 729, 6469, 2277, 0, 2277], [1115051, -3412, -7164, -245439, 1101411, -10130, -36981, -3412, 7449, 4159, 0, -6476, -7164, 0, -4159, -13608], [452444, 6626, -147197, -5262, -460110, 0, 6074, -6626, -11813, 15162, -24925, -5262, 2404, 2330, 15162, 0], [895050, -15992, 4319, 2117, -894458, 0, -563, 15992, -17316, 1708, 20247, 2117, 1525, -7471, 1708, 0], [6712898, -24388, 133061, -126025, 9378, 41890, -4378, 0, -41841, -8793, 41890, 9378, -2342, 2654, 0, 2654], [4734605, 2024, -73931, 78190, 4122, -33070, 49558, 0, 25872, -3328, -33070, 4122, 137, -5674, 0, -5674], [-2506203, -5728, 147527, 2556, 2506698, 0, -16470, 5728, 32375, 3192, -13925, 2556, 2061, 6801, 3192, 0], [-1769128, -3980, -1091, -491117, -1765250, 33833, -40742, -3980, -22421, -3828, 0, 4969, -1091, 0, 3828, -313], [-981781, 2318, -9642, 170511, -981587, 21064, -60588, 2318, -40300, -8252, 0, 9836, -9642, 0, 8252, 10270], [17859, 0, 249965, 260227, -5444989, -46907, 89454, -2966, 24529, 0, 46907, -7597, -17859, -1507, -6049, 1507], [2047424, -5532, -59034, 64261, 2927, 28295, -16587, 0, -9149, 7488, 28295, 2927, 2300, 6417, 0, 6417], [9637, 0, 228927, 250215, -2071827, -22806, -48764, -7082, 15742, 0, 22806, 11651, -9637, 802, -60, -802], [-224257, 12874, 292671, -317205, -10909, -19019, -24617, 0, -53395, -11486, -19019, -10909, -13625, -1075, 0, -1075], [2003740, 634, -75217, 8938, -1997382, 0, -43884, -634, 112225, -13572, -42909, 8938, 2580, 8474, -13572, 0], [-2388746, 30060, -57920, 2285, 2384815, 0, -41641, -30060, 59765, -8628, -33848, 2285, 6216, -352, -8628, 0], [-5210584, 37488, 162481, -201073, -14524, -11846, -46250, 0, -140603, 529, -11846, -14524, -24068, -3756, 0, -3756], [2587050, -14258, -18018, 128231, 2555516, -3771, -72041, -14258, 50324, 5212, 0, -13516, -18018, 0, -5212, 5974], [3068, 0, 198843, 212723, -635900, 313, -61425, -16040, 12585, 0, -313, 10812, -3068, -948, 1864, 948], [-3167530, 34726, -15282, -477067, -3160747, -38522, -52223, 34726, -117877, 960, 0, 22065, -15282, 0, -960, 8690], [133523, -18362, -176041, 207067, 34021, -12747, 148831, 0, -19161, 7440, -12747, 34021, -2995, -3249, 0, -3249], [-6997, 0, -221961, -220173, -4870473, -50695, 28687, 6540, -78683, 0, 50695, 8785, 6997, -8571, 13560, 8571], [2139289, -34036, 295050, 17006, -2108755, 0, 51233, 34036, 92500, 5756, -21597, 17006, -13528, 5157, 5756, 0], [440005, 6464, -453089, -23288, -451777, 0, 67164, -6464, -69726, 844, -44526, -23288, -11516, 14548, 844, 0], [3126975, -12456, -2242, -542922, 3122885, -25061, 19420, -12456, 10719, 3716, 0, -1848, -2242, 0, -3716, 7437], [32932, 0, -216400, -188312, 2647036, -39134, 65242, 19076, 92594, 0, 39134, -4844, -32932, -4310, -11576, 4310], [11998, 0, -79746, -96958, 1905560, 56176, 136817, -4116, 104168, 0, -56176, -29210, -11998, -8806, 121, 8806], [-2937612, -20188, -384982, 352765, -697, 42223, -45011, 0, -185037, -39344, 42223, -697, -31520, 3481, 0, 3481], [-4030508, 23446, -3058, 46525, -3998170, -59749, 12438, 23446, -176663, -8829, 0, 35396, -3058, 0, 8829, -5454], [-686057, 18458, -210031, -5134, 664455, 0, -43335, -18458, -46749, 4129, 3676, -5134, 16468, -29742, 4129, 0], [-17958, 0, -185568, -210873, -3735491, 50071, 36589, 13830, -21761, 0, -50071, -7347, 17958, -5633, 31312, 5633], [4252802, -46428, 118252, -145768, -13398, -8382, -45210, 0, -83728, 614, -8382, -13398, -14118, -3394, 0, -3394], [-4167191, 15080, 415890, 5166, 4182157, 0, 26261, -15080, 126084, -16212, -92481, 5166, -9800, 1361, -16212, 0], [1530595, 6990, -8004, -75446, 1544697, -18080, -40282, 6990, -114770, -10636, 0, 22106, -8004, 0, 10636, -6872], [-5322843, -49734, -233986, 233868, -16523, 104339, -170431, 0, -13838, 6543, 104339, -16523, 16405, -693, 0, -693], [-7294290, 31320, -7048, -426731, -7322630, 23231, -58308, 31320, 78283, 11097, 0, -21292, -7048, 0, -11097, -10032], [8663740, -12430, 17584, 155003, 8650415, 27676, 91473, -12430, 172449, -444, 0, -30909, 17584, 0, 444, -124], [-4226527, -6515, 255179, -305823, -43247, 27035, -200023, 0, -52439, 2016, 27035, -43247, -7397, 10497, 0, 10497], [4063169, -20436, 10364, -752429, 4046181, 22220, 48498, -20436, 138670, 6114, 0, -27352, 10364, 0, -6114, -2340], [-5811112, 18474, 299475, -12502, 5806470, 0, 46518, -18474, -91589, -98, 26503, -12502, -7860, 5186, -98, 0], [6576871, 22292, 237307, -10636, -6606003, 0, -77508, -22292, -60376, -13596, 21356, -10636, 18496, -17932, -13596, 0], [6215, 0, 12554, 3260, 1831737, 12414, 122590, 30830, 37274, 0, -12414, -15509, -6215, -14827, 12296, 14827], [-7989995, 14558, -325079, 370949, 34333, -187, 137519, 0, 59421, 11426, -187, 34333, 11537, 719, 0, 719], [-28414, 0, -282648, -335946, -1119772, 72284, 27244, -54771, -41372, 0, -72284, -24884, 28414, 10300, -29176, -10300], [7299990, 17589, -34814, 328969, 7244359, -40641, -126299, 17589, 55584, 24060, 0, -20817, -34814, 0, -24060, 10373], [-18337927, 32130, -86119, 75081, -23197, -55409, -37379, 0, 71393, 23548, -55409, -23197, 12159, -16711, 0, -16711], [9102043, -5442, 329551, -28346, -9179729, 0, -216990, 5442, -108294, 9306, 14540, -28346, 49340, 7942, 9306, 0], [8634469, 23807, 127234, 16652, -8595999, 0, 80490, -23807, -61234, -820, 134624, 16652, -21818, 11128, -820, 0], [3768344, -14512, 310897, 48648, -3748872, 0, -179581, 14512, 262522, 6343, -5053, 48648, 29176, -8604, 6343, 0], [-33777, 0, 288655, 256237, 13512987, 19711, -46150, 73106, -115397, 0, -19711, 1359, 33777, 6593, -5099, -6593], [-3136874, 22732, -8076, -62975, -3190163, -46529, 69551, 22732, 236178, 1928, 0, -45213, -8076, 0, -1928, 20117], [-6924274, -31880, 10008, -682121, -6933858, 38495, 18221, -31880, 95052, -4164, 0, -19592, 10008, 0, 4164, -17080], [-13234, 0, -131625, -95901, -3905474, -39051, -273919, 36116, -91987, 0, 39051, 48958, 13234, -5266, -29754, 5266], [4294199, -32528, 9992, 468118, 4316031, 57955, -7950, -32528, -37323, -14632, 0, 11840, 9992, 0, 14632, -2747]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_160_n_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_160_6_n_d();".
// 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_160_6_n_d(:prec:=16)
    chi := MakeCharacter_160_n();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 6));
    S := BaseChange(S, Kf);
    maxprec := NextPrime(997) - 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_160_6_n_d();".
// 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_160_6_n_d( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_160_n();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,6,sign)));
    Vf := Kernel([<3,R![342961990915866624, -277309224534269952, 112112140774606848, -24653440226469888, 3071624271586560, -143887832729472, -1658760864736, -47686861984, 144733943824, 1414691520, 11226448, -3435728, 769976, 5544, 50, -10, 1]>],Snew);
    return Vf;
end function;