
// Make newform 1617.4.a.q in Magma, downloaded from the LMFDB on 15 June 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_1617_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_1617_4_a_q();".
// 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_1617_4_a_q();".
// 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 := [-224, -676, -256, 383, 73, -38, -3, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], [-12, -1, 1, 0, 0, 0, 0], [240, 290, -311, -73, 36, 3, -1], [-1328, -1414, 1003, 291, -108, -11, 3], [-1064, -1870, 955, 315, -108, -11, 3], [-676, -1598, 725, 339, -96, -13, 3]];
    Rf_basisdens := [1, 1, 1, 12, 24, 24, 12];
    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_1617_a();"
function MakeCharacter_1617_a()
    N := 1617;
    order := 1;
    char_gens := [1079, 199, 442];
    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_1617_a_Hecke(Kf)
    return MakeCharacter_1617_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 := 4;
    raw_aps := [[-1, 1, 0, 0, 0, 0, 0], [-3, 0, 0, 0, 0, 0, 0], [4, -1, 1, 0, -1, 0, 0], [0, 0, 0, 0, 0, 0, 0], [11, 0, 0, 0, 0, 0, 0], [15, 1, 2, 0, -3, -1, 0], [21, 6, -3, 4, 0, 1, 0], [8, 5, -1, -2, 0, 1, 1], [-2, -8, -2, 0, -9, 1, -1], [-61, 7, 8, 0, -18, 2, 1], [43, -6, 3, -4, -4, 7, 0], [-13, 9, -12, 18, -7, 3, -2], [-47, 38, 1, 4, 11, 4, -5], [12, -18, 30, -12, -15, -5, -1], [158, 1, -13, 16, -5, -2, 8], [10, -70, -6, 6, 1, -3, 5], [219, -47, 14, 26, -24, 4, -3], [-152, 90, -2, -26, -2, -2, -6], [-57, -85, 30, -6, 13, -3, -10], [-76, 118, -2, 24, -22, 0, 4], [244, -37, 27, -30, 36, -7, 1], [100, 52, 24, 18, 14, -16, -4], [-153, 126, 11, 28, -2, -3, 6], [62, 18, -32, -2, 54, -24, -6], [46, 90, 40, -12, 37, -15, -9], [322, -214, 16, -32, -49, -5, -7], [611, 32, -11, 8, 73, -14, 7], [-451, 77, -84, 30, -20, -26, -11], [164, -36, 2, 78, -39, 1, 11], [208, 18, 92, -54, 44, 10, 12], [448, 72, -64, 18, 107, -11, 9], [-115, 458, -39, 12, -19, -26, -11], [-730, -108, 40, -90, 5, -33, -5], [-179, -136, 47, 22, -29, -28, 11], [-845, 171, 16, -114, 52, -6, 5], [322, -242, 144, -12, 15, 19, -19], [1097, -144, -77, -40, 69, -20, 7], [463, -37, 130, -12, 119, 13, 30], [-274, 152, 94, -4, -221, 25, -1], [986, 228, 26, -56, -106, 40, -14], [284, -88, 72, 30, -172, -30, 10], [-143, -170, -51, -24, 136, -55, -8], [-674, -348, -162, 120, 93, 47, -11], [424, -34, -4, -60, 91, 75, -7], [328, 56, 30, 0, 80, -6, -8], [689, 170, -43, -52, -42, 11, -2], [1140, 6, -106, 24, -170, -4, -12], [967, -470, 231, -92, -125, 18, 43], [1191, -704, 57, -56, -211, -38, 47], [463, -344, -39, -8, -134, -105, 0], [-512, -488, 42, -66, -132, 24, 6], [675, 423, 84, -6, -2, -88, -27], [-614, 285, -405, 162, -46, -37, 13], [257, -1021, 38, 86, -144, 44, -9], [2015, 355, 62, 146, -158, 50, -69], [1745, 573, 40, -120, 218, -122, 21], [-105, -94, -165, 104, 253, 8, -35], [1503, 53, -364, -60, 341, -55, -26], [-276, 280, -42, -78, 214, 54, 8], [-1533, 391, -164, 150, 242, -152, 3], [1930, -411, 329, -310, 12, -33, -11], [-526, -692, 14, -60, 130, 84, -50], [1009, -596, -149, 158, 63, -16, -85], [2555, -652, -7, -14, -93, -110, -97], [1612, -286, -418, 176, 61, -69, -53], [-4192, -244, 174, -186, -87, -15, -21], [1920, 904, -168, -66, -192, 86, 34], [3188, 374, -8, 36, -459, 217, -49], [704, 500, 172, -180, 498, -34, 58], [4745, -631, 260, 268, -111, 13, 28], [737, 949, 6, 162, 318, 178, 41], [1356, -476, -4, 102, 298, 124, -56], [3335, -738, 7, 380, 273, 136, -23], [-602, 134, -686, 168, 213, 31, -37], [1489, 1617, -514, -72, 759, -71, -64], [2631, -340, -367, -74, -121, -90, -33], [-2500, 624, -38, 90, 192, -196, -38], [5331, -350, 335, -196, 462, 13, 26], [-342, -56, -140, 498, -83, -153, 119], [-6691, 466, -363, -168, 483, -128, 19], [-1341, -857, -440, 126, 682, -104, -111], [749, -1285, -164, 66, 11, -199, -82], [-2439, 649, -392, 336, -92, -84, -85], [344, -1804, -336, -112, -64, 0, -80], [-393, -563, -160, 52, -39, -27, 42], [3034, -1670, 384, -114, -264, -26, -40], [-6138, 912, -124, -306, 56, -94, 14], [4000, 298, -364, 144, -321, -101, -7], [3454, -670, 532, -460, 248, 8, 94], [651, -101, -134, -144, 15, 61, 86], [2189, 485, 596, 58, -756, 130, 1], [2300, -628, 736, -236, -113, -9, -25], [-5020, -224, -288, 264, -8, 132, -184], [1305, 97, 552, 114, -560, -10, 57], [4333, -1415, 254, -438, -613, -281, 18], [-2040, 1146, 166, -328, 395, -339, 17], [-473, 762, 807, 20, -97, -50, 91], [-441, -3925, 446, -94, 140, 124, -3], [-1720, 107, 437, 306, 438, 93, -163], [1932, 80, -930, -108, 688, -302, 52], [6388, -1406, -514, -108, 1048, -46, -102], [-2749, -317, -628, 300, 180, -180, 63], [-4883, 826, -551, 224, -750, -421, -2], [-6720, -1172, -286, 378, 500, 152, -10], [1936, -506, -282, -372, 746, -436, 152], [-2552, -2654, 454, -436, 441, -37, -89], [5913, -485, -1086, -210, -310, 6, 17], [1077, -1310, 445, -632, 559, -280, 115], [4026, -1096, -118, 456, 1302, 264, 54], [578, -769, 309, -114, -706, 277, -161], [-1907, 2105, -358, -420, 1093, -209, -138], [-5914, 170, -162, -852, 875, -467, 21], [-8622, 1304, 1024, 192, -360, 472, -244], [-3212, -3404, -372, 280, 391, 171, -137], [5156, 1028, -592, -336, -158, 26, -306], [-2726, 692, -428, -552, 347, 275, 107], [13776, 510, -158, -28, -613, -135, -87], [-1402, -4177, -307, 144, 15, 360, 178], [-2826, -974, -118, 486, -546, 326, -134], [-6347, 1161, 300, -690, 112, 166, 13], [-5333, 36, 101, 404, 366, -501, 128], [4422, -2836, -260, -48, -597, 167, -77], [1954, 1320, 1326, 676, -94, 228, 86], [2052, -204, -716, -414, -761, -39, -187], [-3224, 1234, -182, -296, -846, 172, 320], [-2080, -440, -1010, 366, -278, -134, 340], [2353, 755, 268, -222, -1613, 417, 182], [3774, 879, 841, 756, 443, 136, -166], [1945, 6056, -421, 264, -260, 67, -130], [-4580, 1370, -378, 126, 402, -490, -82], [5562, 1364, 158, -324, 51, 69, 171], [-6791, -783, -952, -486, 1584, -18, -123], [1599, 3115, 846, -480, 171, -75, -126], [7631, 3517, -360, -606, -569, 521, 48], [1561, -3056, -321, -808, -881, -206, 249], [3316, 2389, 605, -458, 230, 17, 33], [-2246, -1241, 615, -188, -1439, 672, 122], [642, 243, 551, 478, 832, 753, -153], [15184, 2781, -1357, 432, 537, 304, 92], [6395, -3101, -1168, -78, 782, -512, -249], [2480, 5155, 989, 274, 40, -209, 175], [-2191, 381, -996, 474, 1326, -72, -147], [2843, -869, -402, 1524, 101, -169, -112], [-3867, -3919, -44, -342, 1064, -574, -7], [5791, -4864, 945, 352, -153, 612, 17], [6116, -2675, 1429, -412, -1447, 94, -174], [732, -2482, 158, -322, 1172, -548, -172], [-18493, -378, -529, 252, 611, 114, -241], [-1794, -1892, 1238, 408, -2340, 746, 168], [-8708, 694, -610, -876, 979, 177, -271], [1350, 1866, 114, 498, 592, 332, 264], [5953, 1015, 1908, -306, -1682, 20, 403], [12021, -2539, -1218, 408, 1369, -605, 94], [908, 3408, 944, -24, 509, 105, 289], [-15364, 2904, 1876, -798, 124, -38, -206], [1134, -2544, -18, -528, 1920, -194, 128], [12864, 580, 1328, -288, 1117, -371, -359], [9413, -463, 682, -1494, 112, 140, -257], [5507, 3346, -133, -1176, 1291, 42, -425], [-5086, 132, -1390, 2188, -1246, -80, 10], [15306, 1034, 2324, 288, -1908, 96, -78], [-11185, 2951, 1196, -54, 156, 462, -279], [-1140, 7856, -184, -780, 862, 122, -162], [1091, 395, -2740, 234, 3390, -612, 173], [-2176, -7706, 320, 480, 1253, -71, 3], [-5787, -860, 519, 98, -877, 968, -245], [6995, -5101, 1610, -444, -43, 711, -32], [6314, -3746, 216, -1750, 666, 24, 138], [12080, 1994, 1044, -552, 670, -1118, -164], [24688, -2625, -1563, 1316, 509, 478, 34], [-11643, -3267, -228, -894, 148, -462, -391], [4335, 518, -1725, 1016, -473, 1358, -85], [-5916, -2088, -196, -1068, -1364, 4, 232], [23658, -432, 552, -396, -693, 127, 95], [-13015, 5154, 733, -112, 1161, -566, 297], [844, -2542, -1942, 634, -242, 14, -166], [14602, -4532, 1590, -468, -1449, 1145, 31], [-11142, -558, -274, -1026, -568, 60, 172], [14021, -4357, -576, 800, -883, 321, 152], [19979, -2377, -1784, -212, -485, 507, -8], [-1873, -1797, -1362, 300, 797, 579, -8], [11819, 1728, -2191, 576, 1652, -987, 50], [1862, -2448, 1584, -720, -378, -1118, 134], [20391, -6034, 759, 2340, -1865, 390, 39], [6106, -2560, -210, 864, -118, 952, 198], [-1420, -285, 225, -1940, 2251, 68, -228], [6602, 6770, 862, 2244, -2686, 284, 440], [-10208, 13456, 808, -276, -1377, -549, -165], [-19532, 1078, 480, -1404, 247, -805, -447], [-160, 326, -2902, 100, -255, -197, -521], [23312, 3438, -522, 12, 748, 190, 54], [2659, 1551, 568, -594, -3954, 1084, -163], [-3001, 2219, 946, 834, -1781, 1451, -564], [23680, 133, -73, -1344, -1879, 520, 4], [4353, -6811, -1924, 150, 206, -52, 23], [-8443, 4389, -1978, 746, 2882, -118, 525], [-9274, 10220, -2268, 324, 2311, -65, -437], [-2774, -1452, -1552, 324, -1266, 86, 718], [-2125, -11408, 1605, 440, -3060, 33, 746], [38174, -4156, -1722, 448, -643, -385, -203], [-8488, -8864, 4562, -390, -754, 358, -444], [16701, 8695, -372, 904, 701, 733, -316], [45837, 1068, 31, 1576, -1210, 137, 388], [-5928, 4931, 823, -3058, 282, -393, -333], [11604, 6700, -1264, -1144, -774, 190, 142], [-4085, 13110, -2741, 228, 1975, -234, 23], [1149, 962, 609, 1992, -2195, 330, -635], [27075, -5041, 2788, -630, 684, 486, 15], [-2704, -5376, 2782, -462, -3518, -130, -120], [10036, -5888, -3612, -1224, 313, 725, -175], [-19616, 1370, -36, -492, 320, -112, -466], [-20584, -1627, 1763, -756, -333, 990, 50], [11473, -5847, -670, -1548, 195, 257, -620], [-8646, 8388, -1562, -548, 2096, 146, -196], [-1146, 4592, -666, -648, -1904, 294, 344], [20340, -4702, -2406, -1048, 472, -598, -170], [-5970, 1282, -1144, -966, 1850, 156, 574], [-13145, 16346, -461, -1476, 2654, -1515, 34], [15216, -7562, -1978, 4668, 259, 265, 61], [-1234, -5234, 1610, -186, -3307, 769, 417], [-7938, 1982, 1234, 1236, 461, -157, 539], [29373, 9311, 544, 1352, -2055, -279, 200], [-12012, 1062, 552, 3030, -3471, 1099, -91], [-5343, 5489, 286, -1380, -1255, -129, 370], [-4825, 6176, 3061, -140, 2659, 48, 941], [-11210, 1154, 3238, -234, -3044, 928, -236], [13723, 1705, 1996, -2026, 3114, -628, 529], [-10492, -7190, -814, 84, -1844, -414, 878], [-9503, 2851, -1876, 3184, -2425, -985, 298], [-11469, -433, -3008, -1446, 2762, -1148, 285], [43442, -3520, -612, -1752, 5530, -686, -398], [42062, -1185, -409, 1106, 2210, 599, 257], [40012, -28, 816, 2172, 910, 146, 390], [-4561, 1963, 532, -486, 2490, 56, 427], [9668, 10492, -1048, 372, -605, -825, -413], [11654, -6072, 3750, 364, 580, -58, -536], [39044, -1316, -3180, 1712, -591, -1203, -211], [7879, -11625, 1064, -1602, 508, -1558, -639], [22046, -4458, 1128, 564, 2935, -393, -535], [25854, 2509, 2227, -556, 2149, 432, -230], [7288, 8232, -1484, 3318, -3673, 949, -51], [28195, 3772, -3811, 242, 7349, -336, -391], [22411, 5324, 381, 116, -390, -641, -896], [-33106, 7196, -600, -288, 4536, -268, 412], [13637, 6804, 1763, -3540, -31, 276, 863], [-6578, -6212, -78, -1224, -146, 272, 1034], [62387, -7224, -2799, -1156, 1897, -1158, 327], [40063, -1955, -1182, 1726, 1564, 780, 545], [24600, 4494, 2210, -2184, -4472, 682, 742], [-20399, 7905, -3032, -1260, -1488, -1116, 291], [18206, -15874, -834, 708, 88, 234, -70], [-33927, 9738, -1791, -1636, -2682, -589, -66], [-9632, 718, 790, -816, 3740, -1030, -406], [-3714, -2634, 656, 2776, 5608, -456, 522], [3922, -4440, -2770, 3924, -642, 1168, 618], [29328, -10340, -3088, 948, 510, 1330, -130], [3379, -15287, 932, -1566, -1395, 383, 58], [20756, -3985, 6589, 962, -8204, 1483, -81], [-4466, -2123, 221, -580, -3859, -726, -200], [27440, 7303, 3363, -1314, 4362, -965, 295], [27498, 3022, -1416, -852, 5890, -1594, 900], [-2304, 2776, -2388, -576, -2704, -2420, -24], [9176, 12898, -478, -1294, 3850, -226, 442], [-4277, 8515, -4328, 396, 7551, -1677, 736], [-12421, -699, -1012, -2522, 4862, 2140, -791], [-13136, 7466, -2782, -2556, 3199, -659, -339], [-12868, 6988, -4706, 522, 3400, -2064, -814], [57901, -2941, 384, 1006, -2196, -822, -971], [-10758, 3016, 3774, -3096, -4418, -1364, -314], [-5408, 5852, 1314, 4200, -4314, 1664, 226], [-10779, -1416, 4611, -52, -6063, 644, 611], [-1865, -9509, -1434, -6204, 5717, -885, -116], [-44658, 2416, -3938, 1116, 3547, -467, 251], [-38012, -368, 144, -2106, 3409, 1519, 439], [-43516, 5727, -949, 866, 338, 59, 411], [15145, -4408, 1971, 1800, -2922, 821, -64], [-14008, -12144, 2264, -2184, 574, -986, 442], [19156, 11592, -2050, 516, 1006, 448, 514], [-23472, 5770, -612, 2352, 2751, 259, 305], [-50083, 4692, -3501, 2924, 5602, -879, 132], [14256, 14928, 704, -2460, 1477, -667, -383], [-15380, 6520, -4500, 2028, -820, 1468, -192], [-1672, -2580, -1292, 292, -4977, -2493, -9], [5683, 1243, -5188, -928, -4321, -945, 68], [-53808, -299, 4655, -378, 1920, 905, -367], [-1576, 6434, 5666, -1248, 2615, 709, -1647], [19737, 8807, -1116, -2964, 3667, -193, -324], [10020, 14156, -1006, 3402, 1230, 1550, -1064], [12047, 8020, 365, -1096, -1574, 2627, -520], [-86471, 10232, 2075, 1252, -302, 425, 60], [-38128, 4732, -1374, 1470, 4129, 965, -849], [9068, -28740, -1440, 204, -3674, 382, 966], [-29905, 1103, -2968, 2430, -2410, -840, 391], [-24957, -5162, 1607, 3680, -2952, 463, 788], [-45150, -13458, -2198, 1170, -1378, 2338, -234], [-58846, 6086, 2524, 2848, 2149, -843, 387], [-18975, -9518, -551, -3212, -3683, -3370, 421], [55323, -1230, 3703, -3032, -6367, 1448, 1081], [-23023, -22734, 2249, 1228, 1526, 355, -686], [-1734, -17343, 5245, -1886, -2380, 803, 337], [42320, 3237, -2131, 2610, -1570, 1833, 717], [-7939, -4999, 1160, -1866, -2260, -66, 283], [16454, 12018, -2924, -954, -1077, 1381, -85], [35214, 1566, 8868, 2250, -4001, 209, -45], [-16153, 6035, 2394, -576, -3135, 427, -76], [-37447, 12283, -1012, 3516, -723, 65, -350], [-28414, 12542, -2036, -2976, 6899, -861, 361], [-8707, 9438, -7447, -1528, 6122, -721, -1102], [21400, -6078, 2382, -360, -3351, -1053, 1551], [-5994, 13130, -78, 738, -869, -961, -93], [-38292, 17324, 284, -3060, 4502, 1670, 1346], [-69674, 3990, 718, -4638, -224, -3272, -452], [10203, -12709, -1684, 2598, -5006, 1772, 951], [32292, -5736, 36, 3882, -3984, 1382, 838], [-17992, -4164, -2708, -4224, 2310, -1790, 1322], [-57025, -862, -3293, 7352, -983, 820, -1411], [19618, -2128, -78, 3148, -2616, -1962, 304], [-40536, 1140, 3800, 2898, 5210, 636, -212], [11074, -6048, 5094, 1748, -7525, -1451, 863], [5920, 15884, -6826, -1914, 1800, -2448, 966], [57936, -527, -6233, 950, 7312, -1227, 517], [-64331, 28207, 332, 198, 4817, -653, -96], [-18852, -20802, 1174, 3348, -7582, -1340, 308], [-55884, 10576, 628, -2892, 2780, -1636, -160], [6693, -5611, 168, 2586, -3996, -590, 983], [15586, 9528, -6622, 1684, -1914, 452, -630], [-41796, -15940, 220, -396, -3066, 398, 1006], [-30114, -6694, 6716, 2472, -9379, 41, 1315], [15475, 9179, -10012, 564, 10054, 1234, -1601], [13867, 2331, 8964, -822, -1106, -820, 1371], [-28268, -31300, 7006, 2616, -1434, -180, -1122], [-17814, 650, 5650, 990, 2714, -1110, 106], [-78961, -1123, -3136, 860, 633, 2501, 538], [16945, -4070, 9081, -1528, 1072, -815, 248], [-16152, 1662, -8502, 4212, 9203, -391, -1087], [14853, -19371, -180, -4742, 5934, 868, -1133], [-67835, 9143, 1184, -2022, -4381, -175, 794], [-43617, -4670, 951, 2308, -7024, 3619, -1272], [14938, 8138, -3204, -2220, 10335, -721, -1415], [-3672, -10592, 6300, 1296, -4840, -1656, 920], [74290, -14068, 7308, -3348, -9314, -1398, 734], [-10950, 17692, -3424, 7068, -1259, 2653, 85], [-21858, -13408, 10974, -1068, -6101, 369, 451], [-45491, -11803, -1366, -1620, 533, -829, -2326], [69448, 3956, 1278, 2478, 8651, 203, 1385], [-2479, 2465, 10664, -5478, -332, 650, -1275], [16711, -544, 9133, 508, -4237, 1144, 453], [43980, -17964, 6748, 1992, -5628, 1240, -424], [-19204, -14780, 4820, -1848, 3436, -1656, -324], [-10623, 182, 3357, 3900, -1643, 1014, 1089], [-54875, -9200, 4071, -410, -131, -1410, -619], [83907, -21931, 7332, 3120, -8189, 2767, 586], [-12712, 4648, 1482, -5622, 1786, -1714, -996], [93925, -1619, 1010, 6056, -2551, 363, -718], [-14470, 14898, 5210, -1278, 5221, -71, 577], [10445, -23212, 6279, 728, -2170, 429, -228], [-104870, 3893, -6141, 2220, 2751, 638, 332], [17667, 3776, 6129, 4088, 3301, 986, -1037], [-20681, 14687, -3180, -2142, 1886, 1216, -525], [-109414, 23128, -426, 5640, 1621, 519, 209], [-5536, 5608, -5130, 3282, 10314, 1170, -720], [17653, -11840, -501, 1200, -2675, -124, 1167], [-21872, 15322, -3858, 1752, 2638, -900, -412], [-9843, -4951, -4528, 2034, -3062, -732, 203], [27472, -3376, 0, -3368, -2454, 666, -1106], [-14923, -21677, -8188, 402, 2771, 2837, -406], [-7420, -9670, -11618, 1848, -1817, 1313, -211], [18296, -12504, 2924, -774, 1686, -2132, -1996], [31376, 20446, 1068, -276, -6032, 2808, -1342], [65768, -12228, 840, -492, -743, -543, 2681], [-89166, -3950, 0, 548, -5293, 503, 589], [-12157, 13203, -12636, 1296, 9928, -336, -1747], [-17831, 9649, -3336, 2124, -754, -2614, -217], [16612, -9808, -9416, 3252, 10064, 552, -284], [52405, -10569, 11380, -246, -3977, -279, -946], [33387, 4143, 4884, -4130, 3948, 850, 3], [-701, 21103, -3820, -7728, 3688, -156, 761], [9878, -12085, -1671, 234, 800, 187, -1831], [323, 1772, 4909, -3400, 1903, -2096, -379], [-73889, 7358, -5397, 7752, -4353, 254, 919], [-73768, 19693, -2169, -2164, 4845, -456, -980], [99562, -13792, 3764, -5904, 6247, 1327, -605], [38232, 18712, 2064, 1518, -3452, -718, 426], [103135, 16843, -8452, 6246, 566, 3056, -181], [-48503, 10336, -6005, 9490, 5103, 1024, 683], [65556, -8903, -1479, 3020, 6791, -2608, -636], [49199, -11485, 26, -456, 2301, -4705, -1028], [21701, -38710, 613, 2368, -4793, 312, 575], [-118376, -5538, -7902, 1284, 4539, 929, -23], [2160, -4009, -3829, 5396, 7355, 1006, 550], [36663, -12383, 12540, -3606, -13225, 357, 2272], [11005, 7786, -43, 952, -10225, 2876, 979], [41874, 7954, -11224, 8652, -925, 787, 33], [-72988, 34082, 8386, -284, -5837, -15, 285], [33054, -636, -10554, 1260, 8046, -4008, 1770], [112604, 4302, 7596, -2340, -7541, -1293, -2239], [8901, 15941, 2802, -5804, -3047, -1937, 1030], [-81725, -10259, 1800, 1702, -1040, 2526, 1243], [-9504, 4456, 8160, 2238, -14900, 2826, -1474], [-84341, -33737, 1308, 3102, 1734, -620, 1907], [-32521, -2971, -6614, -448, 10693, 2419, -1788], [20556, 1870, 3100, -1716, 5107, 559, 1465], [-15538, 26070, 4768, 6864, -7565, 3035, 1641], [57236, 6922, 1874, -954, -3584, -5244, 1320], [-24704, -2478, -4934, -1460, 11827, -4259, 909], [-54387, -1701, -6288, 9784, 6165, 1273, -1440], [40049, 31915, 5272, 5154, -6267, -129, -528], [45168, -11124, 3306, 7314, -8738, 838, 1000], [62050, -850, 8532, -7084, 3354, -3758, -692], [-145404, 3064, -5744, 5192, 4384, 480, -944], [-18773, 39646, -3885, 332, 11881, -152, -331], [-5976, 5336, -2062, -3144, -1978, -3676, -754], [28378, 114, -3036, 4488, -1282, -3294, -812], [-60706, 17704, 10742, -2124, -1377, -247, 1267], [36516, -2182, 8588, -6468, -5004, 300, -978], [93822, -701, 8655, 556, -4207, -1232, 1150], [29361, 8413, -6124, -3768, -1944, 604, -565], [49185, -16048, -1413, -864, -7742, -1167, -852], [-44916, 23758, 3494, -2110, -2388, 64, -1572], [91592, -5484, 8844, -4832, -8561, 551, 51], [-10744, 14240, 1854, -6210, -149, -2693, -71], [-24713, 13653, -9270, -576, 7709, -4885, -1812], [-44118, -18920, 8990, -7716, 2261, -1477, -2971], [82515, -19754, 963, -6836, 2654, -1571, -798], [56440, 21614, -10594, -2648, -2984, -2530, 1862], [26902, -13185, -13129, 3672, 4083, -254, -1240], [-16972, 10920, 6584, -8670, 1203, 945, -3843], [-13633, -43101, -2588, 2910, 830, 980, -1117], [68732, -31168, -4896, 3628, -5998, 2414, -370], [101482, 2330, 4048, -6936, 3404, -1620, 330]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_1617_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_1617_4_a_q();".
// 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_1617_4_a_q(:prec:=7)
    chi := MakeCharacter_1617_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_1617_4_a_q();".
// 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_1617_4_a_q( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_1617_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,4,sign)));
    Vf := Kernel([<2,R![-740, 52, 927, 270, -127, -35, 4, 1]>,<5,R![2387792, -133484, -359910, 4315, 6386, -264, -20, 1]>],Snew);
    return Vf;
end function;