
// Make newform 1617.4.a.z in Magma, downloaded from the LMFDB on 16 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_z();".
// 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_z();".
// 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 := [-4032, -9216, 7840, 8716, -3439, -2176, 651, 168, -45, -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, 1, 0, 0, 0, 0, 0, 0, 0, 0], [-10, -1, 1, 0, 0, 0, 0, 0, 0, 0], [7, -17, -1, 1, 0, 0, 0, 0, 0, 0], [27840, 77696, -91744, -24404, 35809, -2391, -3144, 432, 79, -13], [-29568, -46912, 82064, 13132, -30335, 2721, 2616, -384, -65, 11], [49728, 96704, -164320, -24044, 63397, -6747, -5544, 888, 139, -25], [19136, 30208, -61936, -7668, 23453, -2475, -2040, 320, 51, -9], [97152, 146528, -261736, -37040, 97405, -9807, -8448, 1308, 211, -37], [280512, 474176, -837664, -122180, 317245, -31899, -27624, 4272, 691, -121]];
    Rf_basisdens := [1, 1, 1, 1, 384, 192, 384, 128, 192, 384];
    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 := [[0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [3, 0, 0, 0, 0, 0, 0, 0, 0, 0], [2, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-11, 0, 0, 0, 0, 0, 0, 0, 0, 0], [8, 4, 1, 1, 1, -1, 1, -1, -1, -1], [17, -2, 3, -2, -2, 1, -2, -1, -2, 1], [-6, -1, -2, -2, -1, 0, 2, 1, -2, -2], [10, 15, 4, 2, -2, 0, -4, 0, -2, -1], [-2, 17, 0, 4, 5, -2, -2, -1, -4, 4], [0, 0, 0, -1, 2, 4, 6, -3, -1, 3], [38, 7, 8, -2, -2, -2, -9, -4, -2, 5], [-25, -3, -25, -6, 5, 3, 12, 0, 2, 5], [48, 13, 7, 3, -6, -3, -1, 0, 3, 5], [88, -23, 4, 3, 0, -2, -4, -3, -1, 2], [-4, 36, -4, 1, 12, 2, 6, 1, -3, -1], [80, -9, -4, -3, -4, -14, 9, -7, -13, -2], [208, -92, -19, 2, -1, -11, 2, 2, -8, 6], [57, 87, -4, -4, 4, 4, 1, 14, -8, 5], [60, 5, 10, -14, 6, 10, 13, 8, 20, -15], [4, 62, 11, -1, -13, -7, 15, -13, -7, -5], [138, -20, -39, -14, 21, -27, 8, -12, -8, 22], [143, -57, -40, -19, -4, -20, 23, -5, -11, 10], [376, -198, 8, -30, -30, 4, -14, -8, -20, -2], [-99, 32, -36, 29, 50, -32, -48, -3, -31, 21], [186, -83, 54, 4, 13, -10, 4, -1, 38, -16], [58, -212, -96, 14, -18, 4, 30, -20, -20, 12], [237, -9, 13, 26, 51, 5, -26, -10, -8, 7], [-58, 104, 35, -8, -7, 43, 2, -8, -12, 22], [-54, 46, -18, -31, -24, -4, -38, -57, -39, 15], [338, -107, -118, 1, 21, -16, -71, 12, -13, 15], [284, -244, 31, 29, 43, 23, 21, 13, 37, -7], [-98, 8, -126, 20, 2, -12, -2, 0, 12, 6], [196, -9, 43, 49, 0, -23, -1, -40, 23, -11], [238, -105, -69, 5, -62, -41, 3, -10, -11, -21], [810, 135, 77, 0, -12, -5, -20, 51, 4, -36], [-1170, -25, -70, -39, 22, -6, 21, -5, 7, -4], [505, -15, -46, 16, 2, -12, 83, -58, 46, 13], [538, 238, 30, -42, -28, -38, 48, 6, 8, 36], [352, -192, 49, 15, -67, 15, 55, 27, 25, -9], [-174, -319, -84, -32, 76, -50, -83, -58, -64, 47], [-100, 202, -98, -30, -50, 64, 14, 14, 4, -16], [14, 210, -184, -8, 6, -38, -62, -22, 2, 58], [-414, 66, 0, -26, 56, 108, 98, 22, 92, -14], [1634, 475, 47, 125, 122, -5, -107, 66, 19, -19], [-1052, -110, 36, -44, -120, -58, -100, 16, -40, -20], [1346, 114, 15, -17, -1, 117, -5, -19, 5, 45], [398, 64, -100, -89, 50, 120, 68, 17, -1, -21], [143, -57, 80, 121, 88, 16, -43, 77, 9, -18], [-170, -208, -164, -78, -102, -100, 34, -80, -114, 94], [543, -526, 88, 9, 85, -96, 51, -40, -21, -142], [2176, -214, -187, -35, 41, 109, 11, 81, 105, 7], [-2250, -326, -4, 60, 156, -32, 38, 54, 2, 56], [1484, 267, 198, 62, 120, -170, -43, -82, -120, 59], [212, -346, -206, -18, 48, 174, 80, 140, 112, -70], [384, -684, 268, 84, -66, -52, -38, -40, 4, 14], [-582, 208, -122, 48, 56, -10, 137, 142, -42, 46], [-136, 418, 123, -79, 45, -127, -103, -59, 25, -45], [-1216, -772, 32, -200, -176, 168, 38, 20, -28, -20], [1039, 146, -216, -29, -99, -60, -269, -174, -115, 12], [-1736, -82, 351, -19, -67, 41, 63, -59, 13, 107], [1346, -375, -226, -112, -179, -86, -112, -5, -160, 6], [2328, -564, -21, 15, -193, 77, 267, -135, -23, 55], [-60, 413, 354, 38, -46, 56, 168, -94, -64, -147], [-1400, 889, 106, -110, -8, 24, 141, -212, 10, 23], [-694, -494, 246, -92, 74, -150, -83, -16, -22, 86], [2435, -753, 316, 199, 66, 52, -109, -61, 85, -92], [1424, -130, 380, 96, 358, -236, 98, 18, 76, 64], [559, -635, -139, -156, -27, 209, 292, 42, -12, -141], [-824, 94, 91, -14, -107, 183, -268, -28, -94, 146], [2848, -264, 426, 41, 90, -118, -162, 29, 183, 5], [3550, -394, 121, -153, -265, -3, 67, 79, -55, -71], [-2286, 178, 174, -45, 252, 80, -134, 153, -9, 15], [2140, -412, 5, -64, 47, 149, -322, 46, -276, 298], [-35, -53, 356, 218, 224, -40, -383, -12, -184, 131], [272, -627, -18, -87, -78, 240, 109, 289, 187, -44], [2148, -1394, 50, 143, 132, -122, 35, 149, 113, 31], [-374, 323, 236, 192, 104, -158, -587, -132, 104, -5], [-1206, -1032, 12, 87, -90, 396, 6, 169, 25, 85], [-1170, -18, 351, 91, 101, 105, -511, -123, -39, 25], [2194, 1431, 6, 286, 270, -358, -431, -312, -288, 195], [-1040, -339, -152, -25, 14, -144, 509, 39, 73, -44], [962, -1230, 309, 21, 209, -331, -339, -23, -281, -31], [-1089, -1248, 136, -53, -162, 20, -72, 87, -57, -133], [660, -367, -167, -200, 126, -275, 374, -21, -60, 124], [310, -1015, 292, 289, 264, -262, -81, -343, -209, 132], [-1006, 338, -150, -28, -24, -16, -314, 6, -326, 62], [1716, -2572, -817, 3, -75, -55, 69, -65, -137, 69], [5432, 765, 395, 179, 72, 65, -711, -124, -7, -65], [-992, -836, -224, -34, -174, 210, 470, 100, -56, -126], [1352, -67, -2, 119, 514, -490, 49, -181, -53, 106], [3022, -948, -92, -134, 56, -32, 178, -430, -158, 234], [214, 234, -68, 191, 318, 112, -346, -251, 49, 165], [199, 1847, 329, -136, -131, 257, 244, 172, -188, 85], [1098, 1108, -1020, -147, 226, -262, -176, 35, -199, -61], [-2628, 1372, -387, -331, -5, -271, 191, -207, 15, 77], [-1758, 784, 72, 368, 30, -130, -378, -38, 132, -168], [8818, -348, 860, -258, -494, 40, -326, -24, -138, 208], [-2580, 512, -465, 195, 177, 19, 109, 549, -147, -195], [1818, -838, 367, 60, 263, -213, -154, 356, 418, -96], [1504, 627, 936, 26, 79, -102, -256, -69, -76, -98], [2448, 1007, 443, -111, -222, 173, 39, -168, 351, -239], [1114, -594, -1305, -147, -75, 175, 423, -247, -23, -75], [-5702, -1345, -49, -43, -118, -365, -169, 210, -85, 29], [-4482, 373, 206, 78, 157, 152, -418, 163, 108, -252], [145, 1441, 108, 341, 702, -312, -225, 169, -189, 138], [-1908, -716, -574, -80, 52, -242, -120, -66, -228, 276], [-2422, 575, 332, 146, 141, -220, -128, 247, -72, 142], [2638, 782, 242, -9, -264, 798, 179, 261, 423, -239], [112, 138, -404, -176, 62, -112, 16, 500, 222, -46], [1148, -1432, 647, -146, -163, 267, 334, -182, -26, 250], [8108, -3046, -1328, -225, -86, 506, 967, 295, 73, -187], [-90, 1642, 432, 141, 482, -400, -64, -165, -15, 481], [-6221, 781, -262, -384, -254, 8, 103, -70, 380, -223], [-4452, 1174, -340, 583, 204, 30, 218, -389, 141, 81], [8646, 2442, 170, -31, -448, 674, -168, 227, 1, -227], [-7176, 2548, 1178, 80, -202, -686, 118, 120, -214, -172], [3506, -1454, -1408, -247, -354, -6, 307, 483, 151, -21], [-10052, 1100, -596, 45, 414, -88, -363, 35, 293, -337], [2689, -1423, -348, -271, -694, -4, 341, -45, -67, -266], [1264, -1419, 234, -189, 184, -424, -517, -701, -565, 124], [-406, 2982, 1497, -491, -419, 567, -371, -153, -89, 141], [-5982, -2585, -663, -151, -52, -23, 129, -266, 41, -73], [5444, -2349, 152, -344, -56, -252, -347, 42, 86, -75], [-8209, -1721, 1190, 257, 28, 286, 485, 333, 71, -362], [2132, 61, -43, 521, 162, -341, -437, -478, -391, 143], [-3054, -827, 80, -56, 846, -460, -397, -18, -90, 149], [-1520, 2125, 528, 125, -216, 172, -828, 455, -1, 56], [-4706, 114, -82, -666, -524, 70, -346, -360, -72, 34], [-11434, 996, 1877, 622, -507, 553, -812, 120, 178, -398], [-5192, 2286, 1351, 287, 131, 359, 417, 559, 559, -9], [1744, 650, -662, 286, -136, 538, -164, 132, 138, -26], [9742, 0, -464, 18, 182, -550, 818, -236, -92, 354], [-3050, 2111, 1262, -569, 6, 562, 795, 57, 153, -2], [-1597, -157, 123, -36, 355, 183, 10, 192, 450, -239], [-1360, -854, 256, 570, 234, -32, -646, -94, -324, 652], [9662, 2164, 362, 7, 552, -12, 225, 269, 33, 27], [498, 1679, 787, 363, -742, 277, 63, 160, -67, -131], [-960, -662, -922, -211, 4, 166, -539, -197, -627, 453], [7331, 1813, 717, 442, 551, -343, 162, -184, 142, -119], [-4736, 1356, -289, 201, 363, -219, 339, 119, 639, -183], [-18532, 5526, -373, -371, 259, -365, -245, -89, -91, -35], [8180, 1776, 1216, -571, 312, -608, -786, -515, -203, 131], [1131, 1291, 1704, 615, 452, -28, 313, 389, -215, -274], [-110, -379, 1846, -272, -20, -338, 111, -38, 90, -31], [-1202, -2110, 1178, 677, 176, 482, -653, 435, -115, 271], [-3448, 1298, 648, -465, 314, 510, -707, -177, 169, -227], [-2233, -1984, -2786, -367, -619, 366, 87, -266, 37, 84], [-5819, -1871, 326, 957, 664, -258, -57, 133, -331, -12], [2820, 2168, 2568, -479, -204, 126, -701, 425, -161, -155], [-3036, -6106, 777, 796, 393, 589, -282, 744, 624, 14], [13054, 3218, -56, -274, -400, -44, -914, -830, -550, 408], [1797, 1401, -366, 101, -208, -248, 1817, 309, -255, 130], [-4854, 3948, 211, -581, -711, 179, -203, 411, -119, 451], [-9753, 461, 654, 150, 754, -634, -79, -96, 14, 37], [-4260, -345, -524, -217, -264, -504, -242, 201, 321, 404], [5298, 3895, -1458, 277, 275, 276, 1147, -462, 507, 95], [6114, 1454, -406, -157, -1308, -338, -14, -379, -93, -537], [1390, 1962, -654, -368, -1120, 282, 798, 80, 186, -478], [7868, 5387, 158, 566, 131, 24, -536, -143, 52, -126], [6550, -4557, -1688, 114, 228, -184, 201, 464, -224, 83], [9609, -2163, -959, -190, -159, 1585, 1114, 742, 760, -243], [8700, 185, 1352, -123, 1285, -526, 285, 234, 125, -273], [-3518, 8086, 1006, -232, -334, -352, 292, -308, 42, -306], [11130, -1500, -966, 279, 568, -1510, -78, 353, 555, -555], [10356, 4571, 1094, 126, 558, 58, -1288, -14, 14, -305], [-588, -2974, -248, -326, 184, -596, 1136, -470, -240, 104], [-2830, 1144, -2432, 164, 500, -168, 1336, -652, -126, 370], [7664, -1024, 637, 149, -197, -713, -401, -549, 153, 579], [-11228, 3972, -1248, 220, 192, 216, 458, -932, -498, 32], [7833, -65, -3028, -377, -92, 516, 719, 1349, -593, 112], [9722, -6648, 1168, 108, -338, -142, 638, 874, 446, -1544], [8050, -2690, 389, 1005, 927, -15, 1295, -115, 271, -441], [13792, 2432, 790, -990, -784, 542, -202, 422, 8, 310], [-15150, -3618, 354, -172, -246, -174, -594, -436, -708, -246], [6648, -2946, 1434, 551, 752, -744, -960, -903, -257, -215], [8146, -4543, -3123, -247, 356, 813, 127, 344, 39, -87], [658, -2976, 1102, 465, -1018, 1210, -246, 273, 391, -847], [-6530, -5236, -143, 994, 965, -1003, 68, -768, -1048, -26], [2362, -1376, -3390, -728, -674, -398, -550, -184, -714, 30], [10082, -1534, -822, 27, 146, 1392, -1252, 195, -297, 1177], [-5837, 1155, -1763, 4, 13, 745, 2134, 248, -442, 299], [-1980, 5053, 378, 277, 314, -726, -2165, -789, -773, -166], [-3889, 6598, 4224, 219, -267, -888, 383, 86, 81, -504], [23202, -31, -2786, 166, -432, 560, 2053, 146, 250, -675], [-3356, -3600, -696, -662, -280, -1004, 618, -1754, -1014, 542], [19678, -2974, 1144, 773, 198, -250, 1425, 421, -203, -299], [-6329, -4013, -1640, 571, -394, -92, 1215, 511, 579, -48], [-9688, 11256, 198, -92, 362, -474, -682, -372, -252, 8], [16362, 7672, 3379, -1409, -169, -469, -367, -865, -807, 201], [-16380, -1687, -828, 721, -86, -828, 275, 673, 47, -734], [5535, 1221, 177, 744, -295, 109, -178, -1192, -916, 579], [-9061, 1307, -2002, 125, -78, 356, -643, -901, 151, -266], [3158, 5990, -3178, -122, 662, 76, -276, -1006, -1298, 1454], [-1980, -330, 1850, 742, 976, 578, 258, -412, 1146, 434], [-14838, 530, -2542, 489, 1760, -376, -166, 463, 1211, 27], [-11246, 602, 2427, 1727, 833, 521, -903, 1, 859, 127], [-10690, 1005, -1820, -1005, -386, -226, -733, -789, -945, 896], [13500, -112, 1859, -449, 609, -277, 273, -249, 45, 1013], [7000, -594, 1112, -622, 602, 448, 1072, -1390, -16, 432], [19958, -3946, -1415, 349, 141, 23, 113, -39, 51, 403], [5640, -3635, 53, -153, -36, 499, 1659, -380, 583, 229], [17106, -3352, -1466, -98, -328, 50, -588, 816, 194, 106], [-7150, 1980, -1728, 108, -160, -32, 646, -372, 78, -98], [-15298, -4605, -214, 534, -1338, 494, 987, 536, 192, -853], [8068, -1566, 3728, 235, 544, 106, -240, 191, -279, 747], [-19962, 4954, 1470, 179, -134, -80, 1490, -765, 243, -743], [10281, 5983, -2830, 123, 990, -742, 2077, 707, 1821, -410], [10207, -7525, 355, -318, 1319, -269, 594, 350, -172, 751], [-13996, 3486, -2760, -535, -8, -300, 714, 877, -741, 641], [13046, -3920, -990, -284, -348, 22, 1564, 1466, 1180, -458], [27900, -4100, -1972, -21, -1268, 496, 1113, 855, -9, -925], [4750, -2580, 1402, -1054, -1908, 226, -1306, 216, -912, -196], [-1262, 2194, 816, -730, -256, -526, 572, 250, 1068, -580], [-11798, 3356, -1208, 908, -1134, 356, -982, -582, 178, 280], [-2752, -11675, -872, 184, 158, 266, 619, 530, 488, 693], [7504, 9664, 413, -493, -1029, 977, -1491, -231, 225, 113], [7199, -135, -585, -1088, -383, 1483, -544, 3126, 1604, -1233], [22272, 3668, -1512, -439, -468, 1630, 937, 1925, 59, 113], [15618, 2406, 442, 992, 1328, -204, -1010, -898, -1400, 1386], [-50, 6274, -1218, -594, -382, -1574, -412, 222, 796, -1170], [-14770, 4471, 335, -1006, -520, 1035, -1230, 81, -72, 426], [-5288, -206, -1302, 798, 244, 906, -652, -1452, -1538, 466], [9144, 7238, 1286, -1105, 302, 1306, -1720, 139, -79, 855], [5435, 9395, 253, -276, -279, 1281, -1048, -1688, -804, 625], [16418, 6442, -1886, -457, -1076, -168, 2293, -613, -837, 647], [-23212, 6524, 2944, -1225, -38, 864, 910, -683, -105, 333], [-1138, 2599, 3544, -512, 466, -134, -1136, -2250, -826, 769], [-3672, 1929, 5516, 557, 49, -702, -3893, 430, -511, -25], [21024, 616, -382, -114, 1820, -622, 148, -438, -1104, -254], [8086, 1239, -932, 1354, 1238, 1064, 1593, 1640, 2256, -291], [9080, -1347, 36, -50, 517, 878, 1126, -935, -622, 1076], [39806, -813, -2967, -257, 772, 1495, -2813, 820, 133, 25], [10599, 3038, 1318, -605, 1835, 34, -1341, 46, -425, 114], [-10969, -5261, -766, 581, 386, -1764, -39, -1293, -707, 570], [-24188, 896, 2453, -215, -101, 1425, -2631, 409, -51, 335], [12036, 3197, 2058, -561, 300, 222, -1663, 1383, -91, -1340], [12872, -3704, 1335, -1361, -1767, 283, 1775, 715, -623, -819], [8862, 6586, 2026, -718, 144, -988, -410, -72, 868, -628], [3300, -1884, 432, -583, -592, 1194, -2163, 1009, 1143, 677], [-126, -3485, -2262, -845, -1208, 618, 1799, 153, 127, 1240], [28124, -234, -1663, 663, 619, -929, -405, 1499, 291, -703], [-8300, 6580, 742, -652, 1124, 1214, -1688, 1974, 2842, -1958], [-22964, 15315, 3578, 721, 424, -1028, 479, -883, 209, -588], [9196, 3113, 973, 581, -1246, -749, 2143, -486, 1267, -2659], [-4488, 8042, 455, 2267, 187, -181, -1631, 2027, 415, -1643], [-4948, -2046, 1274, 109, -504, 1400, -516, 723, 443, -1791], [-6702, 8581, 1692, 764, 636, -1492, 699, -62, -202, 807], [-1838, 6235, 1477, -357, 1172, 1455, -453, 116, 359, -673], [7964, 5202, -6081, -717, 111, 1115, 3555, 905, 1265, 859], [-322, 7112, 128, -474, -960, -72, -856, 322, 1216, -1340], [-18998, 3715, 328, 406, 1385, -424, -2872, 859, 868, 618], [23630, -4291, 3570, 2531, 996, -1558, 990, 251, -759, 234], [27337, 3125, 702, -517, -580, 1440, 2497, 1171, 1555, -276], [6166, 11620, 3513, 57, -1447, -1083, -1505, -969, -939, -149], [9914, 1830, 824, 244, 1388, 1948, 1248, 1482, 2224, 750], [-15484, 5862, -2642, -1536, 312, 1352, 2550, 706, -362, 1098], [-13146, 11097, 3486, -104, 629, -468, -4234, -1407, -1290, 1282], [11494, 12252, -314, 668, 1304, -724, 1372, 298, 1074, 0], [-19892, 1674, -695, -45, -1331, -565, -1619, 1131, 589, -317], [600, 120, 2507, 1942, 2201, 95, -3650, -686, 10, -782], [3320, -422, -16, -726, -540, -220, 5874, -964, 260, 386], [11274, 2854, -277, 1772, 3435, -1613, 640, -484, -662, -364], [11676, 700, 952, 497, 1592, 1262, 1443, 1633, -759, -195], [-11428, 2476, 4784, -441, -1834, 1296, -1650, -1271, -577, 1113], [21922, 148, -408, 137, -564, -1982, -1410, -1911, -699, -523], [-35672, 15972, 1000, -1640, -2410, 2086, 1485, 1402, 866, -392], [5512, 2072, -2462, 121, 748, 1336, -700, 2299, 1319, 1109], [38164, 3325, -268, 930, 365, -82, -3244, 133, 216, 182], [14710, -4824, -4057, -705, 487, -1701, -1721, -111, -1637, 637], [-23202, 107, -412, -98, -1336, 1378, 1319, -1382, 562, 2205], [-27001, 4011, -1502, -715, -2028, -354, 505, 1257, -391, -1534], [-21994, 4572, -3232, -1952, 960, 1860, 2440, -868, -96, 36], [-3308, 389, -1163, -996, -2032, 1167, 1090, -1185, -2342, 856], [22612, 2316, 1300, -2174, -60, -932, -636, 468, 1686, -126], [-35082, -15316, 1508, -1127, -580, 806, -1840, 725, -507, 49], [29560, 1009, 2440, 2000, 2288, -1138, -627, 522, -80, -845], [-188, 6152, -6558, -1375, 252, 872, 1703, 337, 151, -971], [-23602, 5632, -440, 1364, 1322, -192, -3344, 2568, 1062, -212], [-24135, 355, 349, 258, -325, 917, 1038, -1826, -1492, -877], [938, -2406, -3011, 1395, -787, -1151, -2303, -2275, -547, -789], [-53836, 18098, 732, 153, -62, 30, -2174, -573, -113, 161], [-39398, 10774, -62, 1816, 1590, -694, -1034, -22, -672, 1210], [17080, 11236, 1144, 1367, 3038, 842, 361, -1377, 669, 1315], [-5824, -3999, 3365, -69, -1060, 95, 311, -624, 369, -1689], [31346, -2855, -764, 1376, 474, 1508, -256, -346, 1456, -1061], [-15704, -2798, -6182, -212, 404, -192, 2420, -2366, -938, 1198], [11460, -6731, 700, -1126, -1825, -858, 2412, -605, 572, 94], [8100, 6748, -624, -765, -394, 454, -844, -1503, -1165, 417], [33110, 179, -89, 219, -382, 51, 4423, -4328, -931, 947], [-38916, -8924, -334, 599, 1310, 1386, -1413, 2671, 2465, 171], [12948, -10723, -2610, 2211, 2730, -156, 3955, 1755, 3973, -2198], [359, 10619, 343, 686, -59, -1463, -1854, -638, 908, -559], [-4561, 2317, -4107, -1618, 1727, 1681, 1596, 1954, -212, -1691], [38574, 3900, 3774, 1407, 1134, 128, 945, -897, 1981, -431], [15454, -8816, 2917, -1515, -2233, 19, 637, 1211, 2397, -1159], [-784, 17430, -3754, 1551, 1296, -636, -1764, 1293, 769, -445], [-11516, 244, 6462, 91, -760, -1790, 7, -1995, 737, -187], [10443, 9979, 5276, 951, -680, -100, -1323, -997, -709, -2156], [29990, 6761, -912, 790, -1353, 1906, 1264, 119, 1648, -1120], [1562, 10052, -2003, 847, 1969, -673, -679, -555, -2359, -263], [9916, -11023, 5264, -818, 29, -824, 24, 859, 2958, -1302], [5722, -7001, -3738, -182, 1049, -330, 1318, -1199, 712, 490], [-7068, 9837, 4916, 1169, 386, -200, 679, -217, -1907, -628], [12421, -2417, -1334, -2006, -2188, -676, 231, 698, 66, -1917], [3915, 6007, 1098, -643, 394, -1530, 911, -213, -405, -120], [4064, -9452, -5674, -2106, 2222, 2742, 794, 322, 1070, 1598], [14930, -11695, 3208, -1859, -4236, 3110, -2607, 159, -1491, 502], [3556, 7829, -388, -1625, 816, -854, -1713, -1353, -1483, -258], [-60784, 3956, -3279, 128, 523, 1533, 3090, 602, 2092, -682], [-24174, -1502, 2197, -393, -255, 829, -4463, 857, -1075, -349], [-9000, 3742, 2828, 2854, 2138, 448, -2590, 1628, -666, -202], [-41697, -8942, -2629, -1748, -5640, 2429, 258, -1169, 98, -753], [17147, 6403, 1152, 1072, -1642, -2148, 2943, -632, -1238, 1051], [1862, 672, -1387, -783, -809, -647, -1769, -1349, -1895, -453], [20362, -17294, 77, 23, -737, -417, 1527, 2929, -127, -1843], [-18628, -2803, 6578, -373, -1336, 778, 2809, -639, 2531, -178], [-15494, -24520, -5443, -17, 223, -1059, 2511, -3145, -2333, 561], [24559, -8734, 5910, 620, -3060, -1180, -1304, 698, -942, -1306], [-23182, -9887, 1385, -4851, -2524, 1507, -3149, 1356, -2719, 561], [68494, -4405, -5971, 691, 2204, 107, 925, -132, 147, -157], [-30479, -8504, 2434, 1322, 416, -2276, 726, -1868, -1376, 246], [50802, -5567, 583, -1641, -1718, 2105, 1811, 4090, 875, -1029], [7118, -6816, -470, 833, 2160, 3304, 102, 3735, 5147, -965], [37030, -11669, -2078, -506, 1533, 1120, -1896, 439, 2086, -2098], [11100, -82, -940, 1820, 966, -1740, -270, -1054, 12, 634], [-30419, -3265, -3130, -3894, 690, 172, 2569, 1352, -1308, 2241], [-31983, 8195, 430, -1723, -820, -2966, -491, -1803, -2237, 1806], [-5278, -13866, -7238, -386, -1244, -1606, 3848, -600, -1932, 524], [-55752, -1776, -4985, 233, 1907, 2413, 3773, 1149, 1979, 77], [-41036, -3238, -1027, 890, 2997, -583, -1184, -328, -1792, 2210], [-81154, -19394, 1146, 454, 870, 3104, -2536, 1554, -264, -178], [-22096, 9671, -185, -1151, -3098, 1443, -6161, 124, -2349, 511], [1923, -9285, 1426, 1953, 908, 2186, 1107, 1103, 2603, 450], [45234, -996, 2399, 217, 155, 223, 611, 1737, 2625, -3353], [-56170, 25018, 3788, -266, -1290, -916, -2112, 248, -86, -36], [-27786, 6281, 2254, 886, 768, -160, 1009, -2484, -762, 1187], [-49754, 6473, 967, -1821, -1234, 1877, 357, 1002, -313, 515], [-4624, -3069, -2968, 1283, 2650, -1430, -2767, -473, 1347, 722], [3534, 4979, 881, 2997, 2938, -183, 593, -718, 1561, 419], [-52760, 18146, 6370, 524, -2302, 1122, 3144, 3724, 3752, -3114], [-33642, -2490, -3396, -1270, -3292, 3122, -1206, 1766, -1056, -282], [-27276, -3869, -1498, 76, 335, 1248, 2022, 2211, 1124, -1322], [54636, -17002, -4694, -1040, -414, 1720, 3450, 4228, 2928, -2260], [-14560, -6238, -1314, 93, -718, -3100, -154, -451, -2621, -1459], [-30840, 2918, -4015, -535, 1873, -4355, 2373, 591, -1589, -83], [-3002, -11421, 3888, 193, 360, -298, 1173, -3933, 1733, -620], [-7734, -9418, 9038, -242, -910, -2436, -2826, 2770, 622, -2406], [37380, -13494, -5058, 1746, 446, -3354, -3656, 922, -266, -1196], [10902, -13300, 6948, -1202, -2048, -916, -747, 1182, -632, 914], [-57530, 10607, 5805, -1919, -3250, 3057, 159, -2270, -943, 2479], [-5413, -13354, -1606, -1978, -4574, 3902, -548, 406, -906, 1440], [-79298, 2122, 5028, 1332, -1542, -3484, -3205, -2894, 0, 76], [47400, 2253, -1628, -1023, -313, 1548, -749, 3638, 267, -1713], [-74842, 20894, 5367, -489, 1025, -919, 2757, 1571, 1175, -1637], [-35602, -3037, -462, 902, -947, 1240, 1700, -1797, -714, -866], [44758, -22, -1612, -913, 1994, 626, 937, 4045, 2281, -1507], [-5141, 4691, 7376, -1425, 790, -456, 3621, -45, 647, 1638], [-3224, -7177, 5066, 1604, 2225, 1486, 1374, -1209, 960, 144], [34352, -16096, 456, 371, -176, -510, -5001, 131, -847, 1807], [18154, 18734, 7139, 2739, -419, 573, -6387, 197, 2341, -2019], [-44289, 20910, 2245, 1438, 1840, -1191, 6062, -2923, 1518, 77], [-55956, -14272, 5658, 124, -2482, -728, 4070, 888, 2362, -436], [32397, -4383, 7911, -144, -1339, 307, -3494, -2610, -2488, 1401], [29190, -19496, -4380, 1787, -442, -4098, 2096, -39, 1305, -1603], [-37565, -1794, 3332, 3888, 6466, 1322, 3090, 522, 2662, 322], [-43892, 4573, 366, -922, 801, -1664, 2356, 99, -364, 802], [92202, -11216, 5337, 1615, -1031, -955, -4279, -3481, -3833, 2713], [-5874, -3950, 1923, 1823, -2273, -4775, -5465, 855, -1881, -1507], [50862, -9337, 5248, -1181, 722, 838, 7211, -1795, 4785, -1404], [57109, -20407, -4758, -2698, -2096, 3380, 6273, 1550, 3118, -2431], [20020, 6546, 7669, 1605, 225, -1923, 5943, -2979, -1549, 273], [-51218, -896, -6779, 381, 2331, -2997, 5541, 1619, 1293, -691], [5868, -27110, -2875, 1279, 1883, 1087, -1649, 539, -1285, -891], [-64642, -18121, 1260, 603, -354, -1878, -1091, -357, -4497, -1706], [-726, 5369, -5704, -2066, 1076, 3026, 6937, 2820, 1314, 497], [-8680, -7816, 1804, 3548, 4016, 1184, -82, -1146, 1426, -2762], [23362, -21306, 3763, 1509, -2693, 2501, 1217, 989, 173, -53], [20825, 12621, 7647, 1000, 3885, -1379, -700, -272, -1602, 1761], [-76298, 9202, -8758, -2312, -800, 2086, 8280, 1282, -468, 580], [27150, 17376, 6302, 2096, -424, 1198, -983, 1310, 1248, -1138], [-44722, 9936, 1634, 490, 316, 148, -6162, 5732, 1530, 718], [24800, -6766, -3627, 1408, 2003, -1245, 2072, 1502, -646, -3968], [17614, 749, -6503, 1547, 2460, -6013, 2203, -1582, -2677, 275], [19070, -4071, -4680, 1090, 2375, -118, -5346, -481, 754, 4434], [19650, 6526, 988, -615, -4230, 4722, -2449, 575, 2187, 4083], [-36760, 4988, -3164, -3101, 3642, -5338, 2704, -1383, -351, -1307], [-52246, -20291, 1686, 1664, 1308, -1916, 1735, -118, -232, -2799], [8640, 13563, -349, -2581, -5490, -2517, -6213, -4362, -1863, 2017], [-4902, -10293, 2776, 427, 866, -5392, -196, -957, 953, -572], [-53599, -6646, -2294, -3013, 4292, -660, -308, -117, 897, 1753], [-13782, -7272, 2602, 3483, 4048, -3648, 9447, 225, 3005, -1221], [22554, 13951, 2332, -2156, -972, 1536, 10417, -2110, 102, -255], [-7073, -8789, 5334, 3032, 210, -118, -7281, 1658, 692, 1837], [21104, -22659, -2020, -1300, 1180, 1784, 284, -2180, 1960, 3315], [32554, 11918, -11127, 1085, 4471, -1481, 5713, 1217, -17, -49], [-32468, 3753, -6201, -1251, 2234, -2295, -459, 78, 97, 1643], [-58366, 11886, 4840, -1713, -1154, 1508, 2752, 1613, 5221, -3769], [47216, -31896, -7388, -2610, -1392, -2132, 168, -4766, -3244, -90], [-54362, 28059, 8133, 1255, -634, -605, -405, 1852, 3613, -2731], [678, 1162, 1284, -806, -1494, -312, -1628, -3338, -3286, 4538], [-2764, -16498, -956, -1790, -2002, 4806, -5120, -1884, -1594, -1252], [41318, -22954, -6045, -2415, 2395, 2421, 7517, 3167, 4719, -25], [57690, -23662, -12494, -727, -2966, 4364, 5238, 2389, 1535, 45], [42748, 20599, -1638, 3574, 1591, -2120, 360, 3693, -594, 456], [-19268, -12514, 1307, 3198, -167, -5111, 4010, 2284, 1412, 854], [15534, -23477, -5318, 3796, 866, -74, -1377, 272, -214, -457], [46499, -4318, -1077, -1198, 3184, 801, -2406, -2151, -3108, 4817], [67049, -1729, 8910, -536, -1190, 1894, -1641, 1290, -426, 2049], [16512, -17531, 6450, 1168, -710, -202, 1135, -1802, 2306, -101], [-135014, 11928, 1390, -452, 4118, 314, 4358, -160, 1420, -432], [4866, -3085, 285, 23, 3274, -2645, -1451, 1876, -2421, 3191], [-55838, 4367, -3182, 2046, -532, 882, 1987, -154, -2812, -385], [-14208, 5331, 5995, -281, 510, 2335, -6209, -1182, 25, 1169], [29270, -5272, -6794, -6596, -3646, 1814, 4568, 2982, 1952, -3596], [38712, 8704, 6112, 623, -2476, -4216, -1331, -5285, -1263, 611], [23046, 10672, 638, -3032, -2228, 146, 3128, -740, -1630, -2556], [-28084, 20844, -2920, 4224, 2626, 2978, 5428, 2630, 4380, -2088], [35486, 17660, 1198, -1974, -2624, -182, -1862, 2584, -3126, -2792], [36578, 13212, 3311, -2647, -1945, 2183, -867, 2841, 1767, 1087], [-118782, 16586, 1274, -2451, 3392, 2232, 1371, 2047, 1013, -1241], [30866, -22966, -11679, -3362, -53, 65, 1726, -3908, -992, 1856], [55930, -8989, 2020, 1934, 142, 2556, -3955, 4510, 404, 1359], [-23290, -28824, 1453, -129, -397, -971, 3607, 3571, 4079, -1723], [-12330, -8521, 6138, 2965, 2214, 2638, 1587, 7139, 7951, -4192], [-51430, -8954, -7084, 3634, 6890, -1268, 1201, -828, -2172, 1174], [-40308, -2752, -10620, -2356, -4374, 6216, -1022, 2186, 876, 152], [-37516, 22153, 5340, -1090, 4073, 996, -6128, -909, 3706, -554], [-35693, -11587, -4470, -2489, -2032, 6754, 1875, 3827, 2373, -4750], [24158, 26996, 3032, 2608, 1914, -2844, -1452, 2274, -184, -2078]];
    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_z();".
// 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_z(:prec:=10)
    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_z();".
// 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_z( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_1617_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,4,sign)));
    Vf := Kernel([<2,R![-4032, -9216, 7840, 8716, -3439, -2176, 651, 168, -45, -4, 1]>,<5,R![-14287026432, -4225711168, 674194128, 193743472, -14728796, -2602348, 151892, 12588, -661, -20, 1]>],Snew);
    return Vf;
end function;