
// Make newform 405.4.a.k in Magma, downloaded from the LMFDB on 06 May 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_405_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_405_4_a_k();".
// 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_405_4_a_k();".
// 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 := [-432, -72, 393, 42, -38, -2, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [-36, 141, 30, -26, -2, 1], [-13, -1, 1, 0, 0, 0], [1, -19, -1, 1, 0, 0], [30, 3, -21, -1, 1, 0]];
    Rf_basisdens := [1, 1, 24, 1, 1, 2];
    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_405_a();"
function MakeCharacter_405_a()
    N := 405;
    order := 1;
    char_gens := [326, 82];
    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_405_a_Hecke(Kf)
    return MakeCharacter_405_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+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 := 4;
    raw_aps := [[-1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [-5, 0, 0, 0, 0, 0], [7, -2, -1, 0, -1, 0], [-14, -2, 2, -1, 0, 1], [4, 0, 3, -1, 2, -1], [-19, -6, -2, -1, -1, 3], [-7, 2, -4, -4, 4, -2], [-34, -6, 2, 2, -3, -6], [-52, 12, -8, -1, 4, 3], [-13, -16, 6, -10, -3, -4], [-29, -10, -28, -5, 5, 3], [-62, 16, 7, 26, 2, -10], [99, -42, 38, 25, -1, 1], [-23, -44, -14, 29, 6, 9], [-127, -20, 58, 27, 24, -5], [-294, -30, -15, -6, 8, 0], [-84, 72, 30, -38, 2, 22], [-36, 164, -8, -30, 12, 10], [-268, 82, -52, 9, -40, -9], [101, 138, -50, 33, 23, -7], [-172, 144, 10, 12, -32, -12], [-369, 6, -34, -45, -27, 19], [-474, -96, 76, -33, -18, -21], [-125, 30, 72, -13, -39, -41], [-284, 220, -14, 53, 22, 13], [-10, 88, -73, 91, -8, 15], [252, -176, -102, 40, 4, -28], [-331, 170, 24, 50, -25, 6], [-605, 94, -64, -61, 15, -9], [371, 46, 139, -68, -21, 40], [16, 170, 75, 24, -22, -30], [134, -252, -50, -100, 18, 44], [-81, -130, -232, -36, 2, 14], [260, -84, -208, 44, 58, -100], [109, 20, -118, -32, 109, 82], [439, 134, -303, -128, 23, 56], [-233, 102, 276, -19, -51, 53], [-267, -334, 408, -43, -97, -63], [118, 70, 234, -34, 43, 58], [-324, -222, 213, -204, 2, 30], [329, -410, 382, 154, -53, 10], [-446, 362, -146, -159, -90, 59], [-1139, -198, -196, -211, 123, -51], [-1578, 26, -154, -160, 167, -4], [-830, -544, 502, -62, -8, -70], [181, 54, -152, 134, 54, -104], [-872, -200, -162, -66, -68, -46], [-869, 522, -466, -119, 103, -107], [-2052, 424, -408, 176, 20, 88], [557, 6, -156, 107, -261, 55], [-436, 168, -418, -172, 176, 60], [-377, 498, 124, 92, -25, 16], [-2114, -496, 407, 327, 2, 19], [-208, -320, 512, 78, -194, 190], [-3330, -14, 474, 70, 59, -98], [744, -424, 584, 5, -110, -15], [112, 864, -128, 92, -22, 16], [711, -170, 785, -196, 167, 32], [238, -540, -59, 205, -198, -99], [-520, 696, -190, -24, -134, -4], [1327, 616, -714, -61, 166, 59], [4219, -90, -130, 17, 131, -99], [-2156, -266, -274, 221, -2, 203], [1688, -244, 746, 134, -10, -106], [-4555, -60, -126, 173, -2, -59], [-1623, -1008, 456, 46, -131, -172], [1742, 384, -292, 42, -52, -170], [-1299, 778, 920, -239, -123, 85], [-1591, -342, 320, -114, -283, 342], [1757, 966, 238, 41, -117, -187], [-3776, -690, 90, 457, -222, 207], [1296, 196, -542, -880, -112, 140], [2641, -894, -264, 695, 23, -53], [-2646, -558, 256, 472, 137, -264], [-4320, 1010, -814, 482, -103, -66], [-508, -568, 134, -524, -58, -160], [-3072, -504, -240, -782, 92, -118], [1680, -832, 945, -697, 140, -233], [-1746, -2306, 20, -58, -17, 118], [-5854, -348, -94, -232, 190, -208], [-2153, -1594, 974, 112, -251, -420], [-2376, -494, -110, -1127, -92, 191], [5148, 200, -364, 150, 160, 14], [-2139, -300, -742, -128, 341, 338], [-2091, 1822, 332, -113, -239, 111], [7412, -1328, -337, 108, -36, 124], [3525, -1186, 530, 411, 205, 375], [7968, 32, -312, 269, 464, -67], [4670, -1888, 409, 113, -180, -239], [-1713, 1250, -652, 611, -21, 31], [-6002, -38, 936, 197, 82, 39], [1672, -512, -43, -63, -650, 113], [-6, -314, 323, 754, 284, 148], [-4633, 30, 324, 264, -148, 318], [1270, 1256, 388, 402, 6, -94], [10050, 2140, -96, -416, 144, -172], [5102, -440, -205, 267, -130, -177], [690, 424, -392, 434, -636, 566], [-343, 1186, -284, -260, -397, 272], [-1796, 244, -2118, 90, -198, 310], [4520, 2, 862, -614, -181, -234], [5847, -1070, -348, -827, 1, 365], [8820, -740, -1013, -950, -80, 30], [-2973, 800, 1740, 108, 239, 54], [33, 978, 80, 1891, -33, 287], [-1305, 122, -1722, 695, -67, 199], [3606, 1776, -498, -1782, -14, -510], [-4564, -2646, 540, -1291, -116, 163], [3457, 1728, -236, -22, -462, -306], [-3071, 806, 1882, 1267, 79, -113], [11596, 720, -1285, -409, -262, 483], [12100, 948, -490, -854, 168, 218], [-3944, -1614, -2484, -1270, -207, 482], [-4115, 972, 1280, -64, 149, 234], [2952, -88, -3064, -181, -700, 171], [-7, 402, 1782, -21, 133, -69], [9268, -668, 1660, 770, -180, 30], [-2022, 1996, 148, 286, -28, -170], [7192, -4072, -445, 231, 76, -113], [1899, -562, -150, 798, -317, -442], [2128, -2760, 2214, -1624, 148, -276], [5956, 866, -282, -1608, 65, 588], [-9254, -1384, -1480, -474, -736, 526], [-8128, 5306, -1652, -22, 577, 114], [11944, -956, 830, 1505, 392, 341], [4778, 1436, 2170, 344, 130, 320], [5174, -4922, -1084, 21, 514, -109], [7476, -3328, -1391, 1929, 38, -791], [2698, 556, 128, -120, -422, 620], [-10359, 3760, -2176, -1678, -519, -368], [-6471, 3738, -660, 81, 539, -539], [264, -1128, 2020, 784, -202, -412], [-10060, -2000, -1497, -1073, 1266, -37], [-10266, 1768, 2139, -902, -974, -530], [-1571, 3914, -284, -2312, 221, 80], [7941, 4682, -2448, 611, -367, 383], [6291, -3814, 2412, 1461, -989, 389], [7734, -1468, -992, 2042, 756, -894], [4044, 1344, -285, -270, 472, 106], [-6885, -60, -96, 1042, 1051, -88], [2566, 5508, -2834, 541, 702, 485], [11182, 512, 4102, -1502, 530, -22], [-13322, 84, 2670, -1436, 272, 412], [11699, -4426, -2072, 1094, 609, -374], [-4698, -1750, -2052, -1099, -156, 531], [13609, 4354, 2104, 519, -961, 195], [3120, -5724, 1072, -360, -346, -168], [10131, -1980, 3860, 1180, -85, 610], [-7675, -1568, -3086, 987, 440, -277], [-16624, 1824, -1531, 597, 1018, 89], [254, 3136, 588, 1521, -474, -3], [16607, -3714, -166, -669, 1041, -273], [-5245, -2396, -1402, -1665, 616, -477], [-17398, 980, -1288, 1292, -924, -36], [-6246, -878, 1254, 1897, 696, -1289], [5721, -1440, 1436, -1274, -607, -268], [6790, -3644, 920, -1321, 1598, 55], [-17838, 236, -1560, 492, 54, 624], [5636, 3744, 2566, -2092, 1528, 316], [-14486, -3216, -322, 1234, -264, 294], [20446, -3276, -362, 1204, 944, -452], [-5671, -1134, 798, -2235, 243, 525], [-1484, -4770, -437, 1396, -1770, 34], [6458, 5868, -3288, -106, 2168, 310], [12835, 2810, 3848, 1731, -1459, -953], [-10985, -5596, 268, -500, -1633, 434], [-9671, -3358, 2499, 1582, 237, -882], [4331, 2656, 1720, -1706, 850, -230], [15725, -2520, -1942, -1213, -728, 379], [-16426, 6854, -2539, 136, -412, -582], [3515, 378, -4252, -648, -1135, -248], [-5214, 330, 3046, 2787, 96, 721], [-2214, -824, 3178, 3206, 896, 18], [-4826, -2332, -292, -1316, -1424, 568], [14630, 5232, -1089, 1502, -1830, 578], [-19252, -4374, -812, -1770, 1153, 30], [22072, 1920, -2060, -587, -894, 385], [7008, 5264, 4174, 738, -364, -38], [-5257, 3810, 3222, -966, 857, -430], [-2847, -802, -3170, -1557, 803, -137], [-14282, 1856, -4569, -2793, -462, -213], [29027, -210, -3829, -204, 803, 232], [15796, -2628, 798, 952, -1226, 920], [6891, -5576, -2314, -2489, -254, 187], [18858, -4572, -1522, 3753, 122, -1327], [1130, -5252, 781, 685, -1156, -167], [21819, -2230, -2380, -519, 943, -387], [17109, -620, -6892, 1238, 994, -594], [-7002, 8372, -1464, -2338, 412, 154], [28720, -3860, 3608, -2214, 918, -530], [-18327, 318, 3712, 459, -67, -2005], [14640, 1104, 4164, -650, 112, -322], [8968, -2816, -4062, -3001, -588, 447], [-33781, 3522, 1356, -1351, 153, 1185], [-1643, 8726, -3802, -21, 381, -521], [-14593, -5504, -3984, 2044, -210, 984], [41161, 690, -285, -1180, -1115, -180], [-7191, 2658, -1790, 1059, -393, 1647], [11162, 2734, -4022, -2952, 797, -612], [334, 2904, -3102, -3779, -1362, -327], [-26009, 2132, -3792, -596, 183, -1430], [-8123, 2314, -1599, 516, -535, -1036], [21575, -7756, 1284, -772, 376, -488], [-5602, -3472, -562, 88, 842, -972], [43898, 1518, -2994, 716, -225, 304], [15753, -4388, 2468, 3044, 223, 1170], [-26576, 4124, -2950, 1506, 388, -862], [-17544, 8636, -432, -1486, -3388, -1178], [4748, -4684, 1956, -3736, 680, 724], [-11744, 5444, 1488, -338, -1702, -1350], [15474, -7252, 2010, 2135, -792, -301], [-378, -5532, -3929, 817, 220, 1149], [11728, -2388, -3906, 1042, -778, 154], [-14882, 10310, 150, 2661, 398, 443], [-8461, 4724, 3752, 4718, 356, -1486], [21748, 1500, -1878, -340, -520, -1652], [8338, -1288, -3276, 1551, 2246, -1333], [-15410, 2326, 4418, 4538, 797, -182], [4552, -6368, -4772, 1070, 1666, 1678], [-16529, 1162, -7202, -2502, 2385, 482], [-47833, 8476, -2604, 16, 661, -670], [-35934, -1908, -2981, -894, 1818, 658], [22458, 3908, 4777, -693, -2120, -377], [-26781, 6002, 2920, 3971, 945, 439], [13169, -3914, 6572, 4984, 1375, -552], [810, -1304, 2868, 5800, 184, 952], [32026, 8528, -854, 3252, 1098, -1008], [10259, 4970, -1847, -16, 487, 744], [-33764, -3072, -6387, -2279, -108, 825], [-25037, -3554, 551, -1632, -1093, -1584], [-20383, 15018, -6892, -186, 656, -32], [-11526, 3328, -5188, 3920, -266, 1332], [-372, -16524, 3179, 3357, -52, 737], [-4972, 3592, 2972, -884, -2096, 1712], [-27932, -1070, -4374, 452, -911, -1060], [-653, 592, -2824, 2382, -2458, -774], [11801, -11466, 124, 389, -3191, -407], [-11366, 6152, -3855, -453, 1346, 1551], [-41548, -10238, 1390, 477, 748, -1653], [-7869, -954, 7834, 4449, -693, 1597], [-35890, 1354, -7612, 604, 389, -1644], [12005, -15058, 5441, 434, 13, 1022], [5732, 2500, 2242, 4930, 2060, 478], [-12316, -11072, -3308, -1620, -722, 244], [3458, 16550, 2034, -353, -236, 1105], [10349, 4814, 7443, 1388, 881, -1452], [-32586, 4068, -1987, -4941, 122, 1107], [-25275, 10478, 5796, 5898, 1088, -168], [-10309, 4922, -1112, -1331, -2699, 109], [1675, -15946, -2760, -4889, 565, 1755], [27486, -6200, 4047, -3674, 1050, -926], [11023, -3778, 5732, -831, 329, -767], [-22021, -6964, 4988, -838, -1536, 326], [8501, -9572, 4014, -3939, 1352, 1405], [-61972, 10464, -609, 2495, -1212, 559], [-4737, 3562, 178, 2312, 1017, 224], [23484, 6396, 4008, -5102, 3672, -626], [-19741, 732, -13190, -2059, 270, -331], [-19139, 10490, -1620, -6377, 1319, 1119], [1591, 4610, -3045, -2294, -317, 998], [-29109, -1354, -4720, 965, 1263, -251], [-33233, 1514, 3732, -4490, -223, 270], [39920, -3976, -1807, -2875, -2718, -1791], [-9531, 2930, 15484, -2821, -1105, -929], [-27297, 4710, 2120, 6688, -226, -1966], [26712, 4908, 5772, 1476, -2854, 3092], [21998, -524, 561, 630, 3026, 2958], [-31524, 872, -5368, 1224, -352, 1596], [-15490, 9938, -3922, 2170, -533, -1114], [-33667, 12366, 516, -1536, -3495, 364], [8034, 7084, 1020, 2282, 3678, -2362], [40734, -9964, 2282, -156, 3530, 1128], [-3225, -1376, -5734, 1976, 2885, -1466], [47012, -5276, -1136, 3058, 2246, -418], [-16637, 1986, 7574, 2693, -1923, -4107], [14960, -9556, 3814, 3484, -4390, -2304], [-42671, 7638, -872, -2146, 1441, -622], [-41052, 734, 10536, 618, 381, -1650], [-27584, 7384, 1575, -2365, 5440, 2435], [79575, 1064, -4070, 1655, 96, -557], [-27542, -4724, -4194, -3534, -4584, 1030], [38064, 19522, -13142, -1796, 1673, 1780], [-37938, 10308, -90, -728, 5080, 1780], [23395, 2434, -654, -6261, -781, 3523], [38724, 3614, -3100, -1195, -4318, 2811], [-12499, 3978, 4298, 5523, 2423, -2945], [8633, -10776, 5618, -2719, -1956, 721], [-30339, -2524, -6142, -1158, 2519, -3024], [-28890, 6512, 8572, 5072, 1790, -892], [58750, -6836, 5052, 3275, -1204, -2137], [21396, -11624, 2390, -5990, -202, -966], [-8409, -4122, -2264, -6501, 2895, -2649], [-22004, 8190, 5054, -2303, 426, -809], [73427, -7114, -11905, 1004, -1045, -1420], [-5156, -5204, -4108, -7369, -734, 2407], [20455, 400, -12486, -4992, -1481, 3690], [-30991, -10034, 3216, -1467, -2267, 1681], [13582, 20522, -6859, -7440, -1024, -1722], [63074, 1428, 4320, 10260, -3156, 64], [-11844, 6420, 6174, 5164, 2062, 1688], [-38595, 2324, -8322, 6719, 40, 831], [-48887, 7728, 12326, 86, 3527, 656], [-21332, -3324, -7594, -4484, 612, 3200], [-8483, -11930, -312, 5670, 2130, -2928], [11033, -21622, 5078, 2237, -3385, 37], [-1385, -5094, 334, -5339, -135, -3191], [249, 538, 3814, 1664, 2431, -148], [17294, 7938, 4896, -3301, 6642, 997], [37138, -7276, 11720, 3406, -270, 2150], [79660, 284, -3068, -6354, 392, -1070], [15272, -1244, 13652, -3693, 2434, -5], [-70692, 14716, -3383, 1438, -1556, -1006], [-18549, 6318, 2754, -2351, 3471, 2157], [48465, -3186, 12540, -6171, 3595, -599], [28933, -6096, -12252, -904, -3910, 652], [-19326, -6274, 17641, 4766, 356, -1368], [51474, 978, -4496, -4545, -3492, 909], [-61297, -746, -1364, 2419, 2129, 1523], [-11352, 16340, -10232, -253, 1064, 2295], [-26818, -4278, 2248, 5760, -939, 4448], [-39079, 18902, -1386, -3295, -3019, -1283], [5394, -2212, 11284, 3461, -2126, -2899], [-60023, -17038, 10386, 2425, 1891, -2375], [30438, -14344, -5266, 6836, -178, -4180], [16215, 16204, -4104, 4868, 2226, -2860], [495, -4824, -10772, 976, -909, -1062], [-18954, 12020, 8230, -9594, 3568, 2458], [37988, -25170, -7578, -346, 1461, 2114], [-5246, -19758, -2246, 1546, -2065, 2254], [60889, -13894, 6614, 1258, 3627, 2638], [38991, 8884, 2450, -2249, 4416, 167], [-65385, -17920, 12966, -5148, 2411, -3130], [-26583, 118, 8740, -2339, 821, -63], [24949, 13374, -12224, -1180, 4242, -1634], [-36335, 4098, 5218, -1859, -3767, 2453], [58375, 282, -7244, -5272, 2775, 1444], [-2500, -2900, 1744, 1758, -1012, -3354], [-61849, -21996, 8496, 3792, 2118, -448], [9790, 8236, -7925, 3633, 4112, -123], [8045, 13298, -12993, -4420, -3431, -888], [-16102, 11776, 11756, 4740, 1046, -3732], [-13646, -4372, -4990, -5097, -4624, -1925], [28052, -8180, 5576, 5722, 2966, 370], [-42717, 6964, 2250, 6217, 270, -2567], [-68384, 5556, -18774, -3506, 3132, 1522], [-13815, -24702, -7402, -1574, 3987, -706], [-3477, -12802, 23276, -6177, -977, -2593], [43386, -4146, 5258, -225, -2820, 1665], [49194, -18950, -8274, 3640, 3041, 1748], [104489, 3862, 6688, 634, -3232, -1000], [-21246, -30916, -3954, -1200, 5982, -2604], [-41954, -14160, -5758, 11266, -1940, -1686], [-83824, -7268, 2471, -3923, -2538, -1839], [6267, -8058, 982, 724, 6703, -684], [-3588, 4804, -3880, -2, -2078, -1722], [76396, 1538, 12888, 279, -3150, 1241], [27712, 9326, -6803, -1200, 3422, 1206], [-81400, -4188, -8948, 2726, -4146, -754], [-63652, 3990, 2838, -4162, 2645, -1758], [-50118, -13348, -6220, 654, -2402, 4418], [41644, -14356, -7047, -7242, -3920, 3162], [120421, 4428, 10602, 3451, -948, 235], [-11306, -18182, 3621, 7508, -1044, 2330], [32799, 2810, -27990, 3645, 2465, -1395], [18518, -10472, -1350, -2780, -5916, 2124], [-81842, -11118, 8138, 1348, -5337, 1136], [-2195, 16646, 2414, -10925, 7323, 3659], [52269, 12560, 2572, -1200, 1700, -1232], [-26388, 12766, 6625, -656, -5474, -1746], [-4022, -28674, -22376, -106, 4735, 3566], [-10748, -10302, 18414, 7528, -817, 2256], [13722, 5532, -9378, 12927, -1152, 1867], [-35563, -18016, 4790, 4136, -2595, 630], [-88173, 13838, 6019, 5208, 283, 5064], [-23622, -24554, 8733, 1948, -8556, 1934], [36964, -6586, 12300, -5433, 2744, -2615], [22871, 6802, -1622, -8495, 2551, -1007], [24360, -11824, 11372, 12413, -5248, 1693], [-31727, 5414, -6994, 10741, 1105, 1129], [18090, 1780, 726, -7358, 4202, -3886], [-80496, 13812, 12006, -10356, 738, 4540], [-5567, -338, 14015, 6576, -4731, -3176], [-27748, 3932, 12660, 1498, -966, -1646], [27659, -5284, -10880, -9058, 699, -1916], [48949, -15956, 1518, -4681, 1926, -5161], [-46336, -364, 796, 1586, -664, -3810], [-29676, 5368, -6481, 6917, -9590, -1719], [-45073, 16682, -13384, 13529, -4917, 117], [72222, -4810, -11722, 6602, 8825, -102], [36928, -8264, -10564, 4512, -3166, 3228], [-39074, 5614, -3390, -8068, 57, -5336], [-25248, -8656, -20306, -4186, 4948, 4430], [47595, 15750, 16284, -6593, 6231, 1627], [73336, -10322, 6026, -2215, 6966, -537], [12035, 12270, 13078, -3927, -591, -4579], [-43839, 16680, 9368, -3734, -4557, -1540], [-64478, -4384, 5817, -1941, 2906, -3641], [37914, 9074, -3184, 102, -2327, 3902], [-65262, 7024, -12366, -2045, 4588, 3099], [36139, -4454, 23148, 1350, 873, -1250], [15104, 1808, 14342, -806, 932, -3758], [-61452, -12540, -33249, -1043, 746, 2465], [54111, 1142, -9346, 2177, -4641, -2075], [-13356, -2840, -4106, 2143, 5144, -5161], [52834, -3904, 17712, -5552, -1508, 1680], [-82627, 31098, -22525, 618, 3753, -3522], [-54734, -5616, 7337, 10915, -2510, 7735], [-58419, 10398, 14042, 8227, -65, -8917], [16694, 34670, -2614, -6335, 1076, 2203], [42923, 10566, -1978, 6219, 3385, 83], [-10544, 6464, 25680, -5466, 3134, 398], [-33503, -8194, 2836, 14049, -749, -4411], [13587, -13018, 23636, 6516, -2016, -5262], [-70770, 3572, 4968, -2070, -634, -8022], [76990, -26552, -3240, -2632, -7590, -2988], [91684, 9106, -27390, -1543, -868, 1639], [61742, 3016, -12162, 70, 3738, 4030], [-59285, 22226, -10976, -4185, -9901, -1013], [60654, -4500, 19604, -6984, 2962, -2220], [13512, -21252, -19272, 2406, 4696, 3002], [-111523, -10190, 23365, -206, -843, -1398], [79514, 7282, 4150, -8508, -1379, 1536], [-45790, -5814, 6939, -10486, -5452, 6160], [-66353, -6390, 10298, 5477, -2949, 6993], [38731, -19960, 438, -6777, 7102, -2177], [-141895, -12422, -4832, 7575, -7213, 151], [-20750, 9280, 10445, 1955, -3290, -465], [70449, 2900, -11224, 42, 3581, 3660], [71752, 2964, 6684, -12536, 2828, 9500]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_405_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_405_4_a_k();".
// 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_405_4_a_k(:prec:=6)
    chi := MakeCharacter_405_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_405_4_a_k();".
// 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_405_4_a_k( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_405_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,4,sign)));
    Vf := Kernel([<2,R![-108, 684, 286, -110, -33, 4, 1]>],Snew);
    return Vf;
end function;