
// Make newform 16.5.f.a in Magma, downloaded from the LMFDB on 25 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_16_f();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_16_f_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_16_5_f_a();".
// 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_16_5_f_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 ConvertToHeckeField(input: pass_field := false, Kf := [])
    if not pass_field then
        poly := [2097152, -1048576, 491520, -139264, 31744, -19968, 11456, -4960, 1432, -312, 62, -34, 15, -4, 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], [-8127774720, 2307620864, -96387072, -25039872, -46252032, 58745024, -25589280, 2711160, 515160, -13546, -134754, 73187, -13836, -2291], [48311304192, -21547548672, 3766566912, -10267648, 72770560, -430709696, 214229280, -52296280, 4773352, -73358, 1042042, -627631, 209196, 2559], [-1279524864, 1316257792, -429211648, 51930112, -5960704, 11499840, -10623840, 4619080, -748984, 24954, -16062, 26581, -13444, 2875], [2696151040, 238452736, -625000448, 189473792, -57182208, 597056, -103520, 4706600, -2131320, 334706, -41366, 4513, -6884, 7471], [-198180864, 276922368, 75300864, -17243136, 4510208, -864064, 766240, -666120, 205736, -25690, 4102, -2221, 1452, -739], [7904428032, -5795840000, 2235252736, -414198784, 58993664, -81223104, 63665440, -22287000, 4629992, -445086, 92170, -216535, 81068, -11609], [1436286976, -3096936448, 1140867072, 221668352, -66960384, -20326080, 32805280, -12122680, 3146376, 149274, 66818, -118459, 27996, -17845], [-36868718592, 8940912640, 179912704, -309441536, -256497664, 329833664, -124652320, 17139960, 4999448, 1147766, -1059490, 527155, -91628, -19011], [19838795776, -5578063872, -414662656, -371536896, 148231168, -178329664, 42427360, -431400, -2018984, -277010, 518662, -184641, -32588, 28401], [-20694433792, 16046653440, -4972855296, 982549504, -134759424, 203316544, -150852960, 53625160, -9651512, 1159226, -537790, 396085, -175428, 30299], [5876088832, -5472813056, 1651974144, -323572736, 86843392, -61533120, 49878560, -17765240, 3542632, -440742, 205586, -127643, 54092, -8885], [-37401919488, -142639104, 2383659008, -888906752, -165837824, 250450112, -13428640, -36025480, 15576312, -613450, -703506, 210563, 121444, -73363], [-48499523584, 4283072512, 2751741952, -725675008, -121549824, 293167680, -40588000, -28455320, 12413416, 496674, -284342, 124041, 92076, -74425]];
    Rf_basisdens := [1, 678952960, 678952960, 678952960, 678952960, 48496640, 678952960, 678952960, 678952960, 678952960, 678952960, 169738240, 678952960, 678952960];
    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_16_f();"
function MakeCharacter_16_f()
    N := 16;
    order := 4;
    char_gens := [15, 5];
    v := [2, 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_16_f_Hecke();"
function MakeCharacter_16_f_Hecke(Kf)
    N := 16;
    order := 4;
    char_gens := [15, 5];
    char_values := [[-1, 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]];
    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 := 5;
    raw_aps := [[0, 0, 0, 0, 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, 1, 1, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0], [-1, -2, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, -1, -1], [11, 7, -2, 13, -11, -1, -2, -4, 1, -2, -1, 2, 0, -2], [-11, -18, 2, -2, -8, 0, 2, 4, 2, 1, -2, -3, 2, 2], [-8, -25, 3, -14, 29, -5, 6, -3, -7, 1, 4, -7, 2, 4], [-47, -9, -6, 21, 47, -7, 3, 10, 5, -2, -2, -4, -2, -4], [47, -80, -8, -2, -23, 13, -6, -1, -6, -4, -2, 7, 5, 1], [15, -72, -4, 60, -28, 12, -4, -8, 24, -3, 28, 15, -12, -4], [58, 96, 20, -8, 38, 14, 2, -6, -12, -8, 10, 30, 2, 10], [-62, 136, -7, 111, 58, 22, -70, 33, 16, -6, -6, -12, -6, -26], [10, 76, -14, 34, -72, 0, -76, -22, -4, -2, 60, -10, -20, 4], [140, -4, 8, 148, -124, -20, 8, 16, 4, -40, -1, 24, 16, 8], [-34, -12, -28, -468, 50, 2, 26, 58, 0, 48, -6, -18, 10, 10], [-134, -156, 13, 75, -42, -22, 202, -19, -12, -14, -14, -28, -14, 6], [-242, -114, -32, -330, 406, 66, -32, -64, -30, 56, -13, -68, 12, -32], [-199, 202, 34, -362, 180, -28, 34, 68, -74, 21, 294, -31, 10, 34], [643, 341, 10, -365, -223, 119, 7, 78, -1, -42, -42, -84, -42, -88], [1807, 608, -72, 14, 73, -51, -150, -81, 42, 28, -50, 119, 53, -47], [-52, -409, 83, 68, 367, -7, -208, 27, 57, -37, 254, 65, 64, -18], [-184, -348, 8, -1948, -648, -112, -148, -76, 4, -40, 116, 12, -36, 4], [-1300, -108, 20, 1472, -424, 104, -21, 40, -100, 36, 36, 72, 36, -60], [92, 193, 13, 420, 457, 47, 256, -187, 127, -75, -318, 63, -112, 50], [608, 819, -201, -78, 25, -81, -330, 1, 61, -83, -212, 237, 82, -36], [-1642, 200, 9, 1563, 350, -46, -274, 69, 128, -178, -178, -356, -178, -78], [3631, -460, 56, -278, 393, -75, 446, 219, -82, -124, 266, -141, -95, 85], [3745, 37, 2, 3983, -441, -139, 2, 4, -141, 210, 7, -522, 312, 2], [487, -824, -128, 400, 968, 248, -128, -256, 24, 41, -400, -89, 48, -128], [-250, -510, -206, -444, 478, 34, 156, 374, -82, -266, 96, 254, -108, -48], [534, 1688, -52, 7632, -838, 98, -202, -34, -284, 72, 222, 74, -106, 126], [6759, -1759, -238, -7993, 1149, -165, -25, 550, -189, 158, 158, 316, 158, -312], [614, 694, 488, -122, -1886, -122, 276, -680, -238, -548, -336, 560, -132, 72], [6738, -374, -36, 8230, -1834, 2, -36, -72, 550, 236, -169, 156, -392, -36], [1624, 1492, 165, -1267, 684, -220, -472, -621, 396, -64, -64, -128, -64, 456], [-12785, -1980, -136, -614, 1129, 181, -754, 43, -322, -28, -646, 259, -15, -123], [357, -2410, 158, 58, 2796, 508, 158, 316, -22, 285, -678, -275, -10, 158], [9976, 3416, -248, -9312, 1424, 16, -89, 64, 680, -232, -232, -464, -232, 184], [18687, 614, -256, 120, -63, 145, 1128, -167, 72, 80, 1464, 505, 87, -249], [-3971, 838, 26, -3826, -1752, -400, 26, 52, -150, -183, 1126, -195, 378, 26], [-11744, -880, -460, 11404, -1620, 20, -381, 64, -336, 324, 324, 648, 324, 396], [-3584, -940, 157, 4157, -2676, 260, -1400, -165, -372, -128, -128, -256, -128, 8], [-982, -3352, 228, 21504, 1974, -178, -198, 642, 380, 168, 594, 150, 474, -78], [216, 5455, 19, 1034, -419, -213, 1246, -395, 641, 449, 1676, 465, -54, -484], [368, -3288, -31, -1807, -400, -208, 1608, 487, -328, -360, -360, -720, -360, -456], [22367, -1046, 1008, -1068, 4113, -791, -1860, -843, -676, 776, -2092, -1307, 67, 299], [-14366, 3886, -184, 16726, -1494, 774, 155, 4, 42, 400, 400, 800, 400, 180], [-366, -2208, 1140, 29160, -8706, -1146, 618, -1422, -636, -1272, -750, 1158, -150, 18], [23100, -956, 976, -21708, -2164, 340, 647, -808, -436, 32, 32, 64, 32, -168], [-884, -520, -359, 2269, -6780, 508, 412, -605, -744, 204, 204, 408, 204, 964], [52, 615, -981, 908, 4639, 809, 1472, 1875, -295, 995, -1458, -1847, 880, -866], [-1256, -3028, -360, -23828, 1064, -144, 3844, -228, 588, -248, -4452, -988, 20, -628], [-7072, 4187, -105, -102, -471, -529, -546, 1593, 613, -899, -1340, 5, -694, 100], [-23100, 4988, -308, -25360, 2896, -176, -308, -616, -988, 660, 803, -528, -132, -308], [1366, -1638, 570, 100, -522, -598, 1116, -1410, -394, 494, 1040, -1562, 916, 992], [19951, 1260, 456, 1250, -3271, 469, -3162, 2307, 870, -892, -4510, -389, -1415, -67], [19695, -4320, -136, 22624, -4008, -120, -136, -272, 512, 49, -1736, -1273, 1224, -136], [962, 3788, -1396, -29980, 1246, 974, -5194, 1350, -1056, 704, 4502, -2734, 646, -1338], [17086, 6212, 1141, -10721, -6398, 1950, 2182, -607, -92, -594, -594, -1188, -594, -534], [2992, 7939, 435, -11952, -21, 637, 192, 339, -899, 723, 966, 1977, -384, 1542], [-21245, -857, -254, -17543, -10687, -637, -254, -508, 1953, -2230, 707, 2794, -564, -254], [-5912, 1872, 473, 6609, 4928, 192, -3856, -137, -16, 1520, 1520, 3040, 1520, -336], [-18641, 8409, 2070, 21947, 10593, 279, -837, -858, 1611, 450, 450, 900, 450, -1212], [-19521, -3934, 1280, 5004, -9951, 1897, 3108, -1283, 852, 1160, 2988, -1523, 123, 243], [-2922, -6440, -110, -3714, -10484, -1508, 1228, 1306, -1312, 198, -1140, -1130, 1108, -1020], [-4381, -5268, -504, -2008, 2996, 1548, -504, -1008, 1348, 1029, 5424, 123, -1152, -504], [2395, 567, 894, 7117, -4731, -1521, 894, 1788, -975, 4206, 3519, -6126, 1920, 894], [-10654, 14336, -912, -1680, 2224, -2896, 1680, 1408, 992, -1552, 1040, 128, 144, 784], [-21350, -6054, 1072, -19662, -830, 102, 1072, 2144, 534, -88, -2485, -188, 276, 1072], [13207, -704, -292, 7972, 9580, 1604, -292, -584, -80, -1859, 7564, 3391, -1532, -292], [16238, -4986, -1274, -1348, 5450, 1046, -3996, -3742, -1430, 2002, -720, 2810, 1740, -1536], [-5649, -1124, -520, -1374, -1975, -1083, 6438, 1267, -138, -1772, 5186, -1237, 505, 1757], [-802, 1492, -204, -28036, -12350, -1134, 6282, 3258, -2688, 2240, -4246, 814, 1018, 1018], [-40910, -2516, -1075, 40627, -3986, 818, 7610, 1565, -1172, 562, 562, 1124, 562, -490], [22782, -10530, -1280, 19798, 6502, 2130, -1280, -2560, 306, -3416, 1747, 1772, 1644, -1280], [-2892, -2016, -1416, -7872, -4452, -1044, -1548, -4044, 2280, -1152, -1020, -1092, -2892, 324], [36546, -15088, 1585, -38425, -7214, 542, -8342, 377, -3128, 346, 346, 692, 346, -1962], [54635, -916, 2188, 47500, 14664, 712, 2188, 4376, -2028, 465, -7836, 339, -804, 2188], [12848, -9277, -1409, 3114, -12927, 2967, 1422, 1457, 701, -1611, 1220, 1053, 154, 356], [-2770, -6240, 1170, -18394, -1420, -1548, 12, 394, 1304, 854, 2012, 3654, -460, 2484], [-12651, 11171, 942, 22781, -8353, 4009, -5553, 1650, -247, -1038, -1038, -2076, -1038, -2592], [-60308, -22800, 4761, 51645, 2244, -4580, -1884, -5845, -768, -1724, -1724, -3448, -1724, 1084], [-5328, -12916, -616, 61276, 11296, -568, 4716, 1204, 3324, 952, -4380, -532, 252, 84], [18000, 579, 2767, 7610, -10287, 935, -3170, -6735, 797, 4421, -1516, -3427, 2314, 660], [51615, 7286, -5312, -5464, 5985, -815, 376, 2025, -168, -3024, 2664, 6601, 999, -1289], [10683, -3825, 1034, 12201, 4097, 867, 1034, 2068, 729, 1842, -4709, -198, -1644, 1034], [-2656, 16339, -1769, 1074, -7879, -2929, 4854, 353, 1949, -2227, 4396, -563, 1874, 2332], [-7022, -10316, -3838, 25114, -4160, -1096, 4916, 266, 1300, 574, -8180, -6794, -308, -2956], [83755, 16716, 1444, 87404, -18816, -3600, 1444, 2888, 1492, -719, 572, 4427, -3708, 1444], [-5476, -1468, -4416, 66212, 2676, -420, -2688, -760, 3244, 2264, 536, -3544, -3024, 872], [22871, 21633, -4930, -23029, 19457, 1175, 8931, 7750, 4067, -582, -582, -1164, -582, -2820], [6434, 11936, 2644, -133208, -8658, 502, -262, 2114, -4380, 520, 3426, 4214, 1594, 1570], [-71873, -11706, 5744, 1288, 4177, -1823, 2456, -7463, -2488, 5120, 1832, -8711, 2343, 2967], [-32570, 9598, -820, -42934, 6378, -1186, -820, -1640, -4110, -2532, 1663, -780, 3312, -820], [71554, -9538, 2464, -78146, 11026, -3522, 6787, -3148, 826, -264, -264, -528, -264, 684], [142383, -17528, -520, -2746, 297, 1021, -174, 103, -2062, -980, -634, -817, 877, 1337], [-35135, -13934, 1778, -37570, 8940, 2348, 1778, 3556, 1614, -3051, 1030, 4929, -1878, 1778], [6886, 31806, -4256, -14442, -24998, 1198, 5764, -1408, -5526, 1812, -8208, -3480, -3220, 776], [-97631, 17269, -406, -93449, -18545, -2995, -406, -812, 1507, -470, -12401, 3334, -2864, -406], [26137, 2618, -2374, 55486, -55076, -4580, -2374, -4748, 7398, 2365, -9794, -2575, 210, -2374], [-98021, 7869, -2910, 95715, 2209, -2313, -15921, -2466, 2167, 910, 910, 1820, 910, 5376], [-146319, -25942, -1514, -159086, 29496, 6640, -1514, -3028, 294, -8023, -2134, 7009, 1014, -1514], [57709, 6779, -1414, -65159, 24363, -4195, -7845, -1214, 3921, 1326, 1326, 2652, 1326, 2628], [-5414, -12094, 2016, -23510, -36058, -5166, -14468, -5184, -1386, -3668, 12816, 1880, -1516, -136], [131295, 43523, -1358, 106405, 13405, -3593, -1358, -2716, -8123, -3878, -7973, 4114, -236, -1358], [-9750, -12220, -332, -13288, 30540, -1964, 18856, 2604, -4548, -708, 18480, 1852, -1896, -1520], [-55895, -25923, -2246, -40897, 1671, 5973, -2246, -4492, 7675, 2698, 17327, 2054, -4752, -2246], [-63062, 612, 5268, -5544, 6700, -8652, -7416, -756, -2084, -1252, -13936, -13796, 2008, 8528], [221023, 7630, -1200, -10496, 26641, -5967, 5568, -6159, -3664, 2160, 8928, 561, 3999, 639], [22596, 41173, 873, 20220, 42461, 10491, -7104, 4145, -4757, 129, 8106, -2141, 4016, -3014], [4088, 7560, -4592, -15688, 184, 3400, -7856, -11856, 504, -9472, -6208, -16272, -2384, -11680], [-124268, -27136, -7223, 101157, 12380, -4220, -116, 8227, -2224, 1868, 1868, 3736, 1868, -1004], [-17328, -44563, 3725, -52640, 7765, -6493, 21072, -2819, 10419, -467, -17814, 9335, -2352, 5610], [-153961, 18931, 1998, -150887, -14687, -5437, 1998, 3996, -3147, 4990, 2551, -7078, 2088, 1998], [71951, 73884, 120, 26466, -52183, 165, -7770, 5267, 14774, -1900, -9790, 1227, -3367, -1347], [-9560, -10425, 699, 15018, -34859, 10323, 5214, 9117, 5353, -2407, 2108, 2905, -6710, -3604], [-129953, -17607, -7806, 126975, -29979, 6355, -5193, 15494, -6549, -2594, -2594, -5188, -2594, -7688], [-194673, -59768, -184, -21418, 44601, 397, 9858, -5081, -12142, 2428, 12470, 143, 2653, 41], [274999, 13576, -1552, 257320, 27032, 3176, -1552, -3104, -1832, -3631, -8576, 9007, -5376, -1552], [74248, 38456, 5260, -39572, -21668, 11140, -25573, -2464, -1208, 2732, 2732, 5464, 2732, -2796], [202120, -21348, 7029, -225875, 61388, -11484, -960, -5733, 4964, 1064, 1064, 2128, 1064, -1296], [70600, 9015, -4213, 16234, -39739, 8995, 7838, 4973, 6969, -2487, 9564, 8425, -2486, -4212], [-121694, -9880, 11033, 148783, -68934, 5654, -24486, -18143, -8016, 474, 474, 948, 474, 7110], [-6964, -42756, 1848, -332, 19252, 3420, 1848, 3696, -2716, 7640, -1329, -18200, 10560, 1848], [132682, -69658, 6784, -144010, -50790, -2986, -11645, -9324, -11694, -1784, -1784, -3568, -1784, 2540], [-62811, 29702, -2354, -57822, -27796, -7364, -2354, -4708, -4550, 4453, -886, -11275, 6822, -2354], [131566, -280, -9935, -145653, 25374, 2514, -22514, 22877, 1248, -3634, -3634, -7268, -3634, -12942], [3560, 19988, -3848, 214468, -11928, 1120, 23372, -2428, -2028, 712, -26508, -3844, -3140, 4], [-21185, 19682, 6224, -1892, 6929, -9255, 19796, -1123, 244, 472, 14044, -12627, 651, 6403], [12651, 5636, 7736, 16264, -37956, -9212, 7736, 15472, -1012, -6243, 30192, 2563, 3680, 7736], [-75242, -7958, 1724, 80334, -31734, -634, 31367, -9844, -2850, 708, 708, 1416, 708, 8120], [-218721, 29962, -784, -14412, 42833, -9495, -17508, -3755, -2820, 2248, -14476, 2309, 1507, -1525], [8656, 2876, -104, 34540, 95008, 10216, -29156, -3292, 11884, -3080, 25972, -3076, -212, -2972], [-283976, -22676, -835, 281861, -27196, 1004, 32456, -901, -6028, 1712, 1712, 3424, 1712, 1736], [10254, 14340, 3590, 25622, 16872, 3712, 19708, 11182, -5740, 4682, -11436, 5362, 6500, 1772], [4312, -14561, 9107, 7450, -18243, -6037, -466, -14619, -2223, 5793, -3780, -21247, 8826, 12140], [191166, 117800, 2849, -148885, 29022, 3858, -26098, -10835, 19872, -4978, -4978, -9956, -4978, 7986], [17776, 20928, -9924, -43724, 78388, -7220, -30165, 16064, 11776, -2932, -2932, -5864, -2932, -6140], [76233, -14486, 4242, 63646, 45348, 2228, 4242, 8484, -9194, 10413, 54198, -17223, 6810, 4242], [-23566, -37000, -6634, 97226, -53676, -8796, -668, 9358, -3920, 6098, 132, -10430, 3260, -3796], [-55607, 75981, -1358, -91049, 13631, -5763, -1358, -2716, -9173, -6574, -5689, 13686, -7112, -1358], [-292006, 36556, 989, 298747, 61990, 3258, 11570, 7621, 4588, 9194, 9194, 18388, 9194, -8610], [-26561, 2994, -12928, -3140, 2081, 5641, -24844, -4243, -348, -600, -12516, 20413, 4843, -7485], [-163577, -7733, -2926, -132995, -50491, 527, -2926, -5852, 15133, -3958, -27317, 14290, -10332, -2926], [-90495, -79054, 386, -39890, -17316, 9724, 386, 772, 17774, 11781, 32790, -7007, -4774, 386], [-92769, -15078, 3104, -2668, 17633, 1689, 16956, -3995, -3220, 5016, 18868, -171, -1021, -2933], [320290, 24460, -8875, -321013, -602, 1530, 39026, 11245, 5932, -8950, -8950, -17900, -8950, -2370], [-15638, -21474, 12, 6938, -121118, -13642, -11716, 7308, -16198, 2744, 14472, -1796, 4564, -1808], [65302, 14406, -15448, 95542, -39386, 1938, -15448, -30896, 8522, 7072, -52373, -6612, -460, -15448], [44082, 81552, 7076, -168376, 53934, 15766, -10934, 5122, -10540, 56, 18066, 9142, 5066, 2066], [-446957, -67132, 852, -417428, 14184, 8200, 852, 1704, 5692, 15753, -49092, -20653, 4900, 852], [44362, -58844, -20796, -27960, 22172, 676, 12888, -12084, -12932, -5940, 27744, 17628, 18024, 3168], [5323, -14227, -13394, -13785, -12379, 5203, 12187, 15214, -8857, 11066, 11066, 22132, 11066, -1820], [-57921, -3926, -6736, -29292, 38129, -3639, -5124, 36565, -1572, -20792, -19180, 8453, -15773, -1717], [24892, -76644, 10096, 29692, 3260, 180, 10096, 20192, -2492, -5248, -54841, -12456, 17704, 10096], [-25502, -43556, -2468, -35900, -5778, -8706, 32534, -3658, 12752, 3472, -31530, 5666, -7130, 8134], [-343761, -80440, 11752, -10762, 29433, 205, 21538, -11577, -12846, 8604, 18390, -17873, 2973, 6121], [255248, -5157, -9521, -2958, 673, 2887, 534, -9031, -2059, 1237, 11292, 12485, 7794, -2964], [-38540, -53169, -19597, 227884, 37607, -3103, 19040, 7611, 17457, 12331, -26306, -22143, -4720, -2546], [-434057, 3576, -10016, -426800, -28072, -408, -10016, -20032, 2216, -6951, 24944, -201, 7152, -10016], [-401905, 6585, 25014, 429371, -10463, -297, -19109, -25434, 2923, -7262, -7262, -14524, -7262, 420], [4546, -15034, 1580, -124158, 28202, 5038, -20356, 7708, -4462, -3864, 18072, -12276, 11572, -13856], [559999, 75854, -20512, -33200, 74017, -14271, -5968, -3983, -3120, -3840, 10704, 29361, 7823, -8849], [345822, 95462, 2164, 323242, -23382, -13154, 2164, 4328, -7926, -3436, 59927, 11956, -8520, 2164], [-62248, 110471, -653, 60098, -107699, 1579, -51882, -35491, 20281, 16881, -34348, -423, 18610, 1076], [114623, -19014, -8288, 9268, -44991, 6585, 3228, -1819, 2124, -4904, 6612, 4949, 6723, 3339], [-43960, -83592, 1760, 491096, -70536, -20824, -9952, -592, 9448, 4784, 16496, 13680, -5376, 11920], [-248666, 86304, -25191, 279579, -16290, 22834, -14250, 39005, 1416, 1702, 1702, 3404, 1702, -13814]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_16_f_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_16_5_f_a();".
// 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_16_5_f_a(:prec:=14)
    chi := MakeCharacter_16_f();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 5));
    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_16_5_f_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_16_5_f_a( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_16_f();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,5,sign)));
    Vf := Kernel([],Snew);
    return Vf;
end function;