
// Make newform 616.4.a.h in Magma, downloaded from the LMFDB on 26 December 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_616_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_616_4_a_h();".
// 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_616_4_a_h();".
// 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 := [-468, -384, 533, 161, -94, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0], [149353, 40754, -51127, 1098, 558, -13], [-14458, 37310, 14186, -7592, -99, 81], [713910, -182819, -221318, 81598, 1636, -895], [-158778, -26404, 121565, -36046, -1042, 409], [-120576, 99179, 49856, -21418, -361, 232]];
    Rf_basisdens := [1, 4879, 4879, 43911, 14637, 6273];
    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_616_a();"
function MakeCharacter_616_a()
    N := 616;
    order := 1;
    char_gens := [463, 309, 353, 57];
    v := [1, 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_616_a_Hecke(Kf)
    return MakeCharacter_616_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, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0], [-2, 0, 0, -1, 0, 0], [7, 0, 0, 0, 0, 0], [-11, 0, 0, 0, 0, 0], [-12, -2, -4, 2, -1, -2], [-17, -1, -5, 3, 3, 0], [-25, -3, -9, 1, -4, 2], [-24, 0, -15, 2, 5, 2], [-27, 1, 10, 4, -3, 0], [49, 11, -8, 3, -2, 2], [-5, 3, 20, 1, -2, 9], [-10, 8, -1, 5, 20, 0], [-60, -8, -5, -15, -4, -7], [-52, 16, 15, -15, 8, 6], [-167, -3, 9, -11, -15, 5], [-2, 2, -39, 2, 2, -16], [-234, 12, 40, -8, -3, 0], [-128, 4, -29, -22, 25, -32], [-246, -2, 49, 4, 13, 8], [-134, 4, 5, 35, -22, 6], [-129, -23, 17, 39, -11, -13], [-218, -34, 9, 3, -41, 14], [-545, 19, 17, -22, 10, 10], [-73, 11, 81, 8, 2, 40], [-593, 11, 52, 52, 10, -8], [344, -12, -41, 77, -4, 10], [77, 31, 56, 32, -33, -20], [-427, -39, 6, -66, 29, -16], [-662, -24, -149, 2, -29, 8], [342, 50, 120, 6, 14, -56], [154, -14, -129, -101, 49, -32], [-765, -33, 24, -69, -68, -5], [450, 26, 23, 127, 19, 8], [-993, -33, -24, 2, 11, -48], [299, -67, -259, 19, -73, 37], [-420, 42, -114, -91, 8, 12], [-554, 78, 290, -86, 116, -6], [422, -62, 282, 8, 10, 34], [-300, 38, -214, -24, -77, 20], [-202, 94, 31, -202, -11, 60], [330, -36, -44, -11, 36, -66], [70, -158, 15, 42, 25, -124], [719, 131, -248, 50, 157, 30], [-1386, -32, 62, 78, 34, 4], [1442, -22, 59, -23, -22, -146], [519, -35, 358, -114, -43, 38], [2027, -15, 196, 35, 86, 70], [601, 35, 191, -97, -60, 30], [-228, -86, 248, 65, -230, 30], [-1023, 49, 312, 158, -135, -6], [-299, -125, -222, 16, 145, -64], [-258, -72, 13, -143, -62, -144], [636, -36, 217, -138, 54, -172], [-362, 12, 210, -130, 192, 98], [2747, 141, -306, -26, 199, 72], [979, -125, 397, -103, -120, 18], [473, -97, -320, 126, -85, 74], [331, -77, 332, 192, 153, -34], [-317, -113, -416, 364, -79, 80], [-427, -97, -265, 51, 44, 66], [1631, 123, 230, -44, 220, -106], [1734, -90, -207, 131, -273, 20], [914, -182, -91, -97, -232, -70], [-815, 49, 469, -174, 130, 44], [-1018, -56, 153, 104, 175, -178], [-382, 50, -151, 130, -49, 180], [-1145, 51, -496, -86, -235, -304], [-367, -85, -479, 31, 89, -3], [1282, -144, -218, -574, -57, 104], [1335, -61, -1375, 122, 94, -10], [-4286, 54, 187, -55, -106, 49], [3099, 265, 256, -381, 182, 14], [-4394, -256, -62, 280, -188, 258], [-2846, -62, 1011, -68, 361, -58], [-3411, 87, -148, -209, -62, 214], [4198, -128, 1379, 22, -191, -234], [-1723, 233, -55, 85, 358, -248], [306, -56, 46, -654, -64, -26], [-1526, 68, 331, 17, 368, 126], [237, -373, -322, -348, -96, -28], [-667, 1, -885, -497, -259, -89], [-4155, -293, -929, 139, -449, -103], [5757, -139, 249, -280, -200, 108], [-1493, 21, -456, -28, -25, 316], [-9698, 142, -339, 464, 77, -106], [-3303, 145, 702, 255, 132, 383], [1406, -276, -762, 52, -400, 50], [-644, 238, -456, 528, 293, -206], [3656, 264, 951, -530, -97, 46], [-1412, 108, 1143, 72, -260, 476], [-2767, -41, 484, 126, 509, 192], [4558, -38, -221, 156, 115, 168], [-9944, 164, 429, -103, 48, 223], [-6600, -76, -940, 340, -154, 192], [2069, 139, 728, 118, -185, -198], [-4082, 272, 168, 301, 104, 626], [3969, -343, 965, -548, -144, -288], [3060, 96, 1571, -135, -207, 30], [-5719, 533, -46, -586, -171, 134], [1906, 306, 308, -356, -162, 432], [-4173, -677, -214, -188, -547, -280], [-10839, 187, -201, -137, -186, -354], [-6915, -43, 552, 398, -69, 240], [-7522, 366, 518, -114, -138, -282], [2007, -341, 1187, -726, -244, -260], [3427, 53, -1616, 50, 430, -140], [-7315, 145, 1565, -1247, -205, -238], [-4414, 142, 886, -194, 686, -472], [3858, 108, -9, 195, -96, 616], [-862, -402, 52, -330, -8, -86], [4204, 530, -10, -204, 420, 322], [-1021, 95, 653, -287, -635, -321], [-5372, -212, 2937, 252, -206, 60], [7184, 32, 371, -152, 409, 558], [1931, 151, -238, 7, 222, -157], [3098, -298, -727, 338, -244, -684], [-4169, -211, 238, 1243, 342, -154], [6258, -340, -1443, -58, 31, -718], [-14339, -169, -215, 1303, -103, -203], [2924, 130, -874, 513, -14, 22], [-4991, 537, -2564, -172, -269, 204], [-62, -72, -886, 662, 631, 154], [-5148, -80, 386, 366, -140, 642], [-1770, 490, -2703, 478, 274, 608], [-12754, 240, -500, -86, -116, -406], [-152, 510, -2163, 274, -59, 142], [9395, 1057, 232, -325, -348, 54], [23023, 277, 112, 139, 560, 50], [-12399, 257, -1128, 404, -412, 382], [-2536, 172, -1064, 410, -654, 458], [3110, -598, -856, 1268, -600, -498], [5068, 52, -547, -484, 687, -224], [-5038, 508, 638, -758, -278, 216], [-24223, -3, 399, -755, 827, -316], [3089, -643, -7, 1979, 267, -430], [4903, 599, -1895, 321, 978, 236], [8152, -532, 1383, 319, -985, -774], [4130, 356, -678, -1579, 110, 300], [7308, -770, -1490, -918, -116, -60], [19005, -233, -553, 509, 334, 80], [-5026, -544, -3994, 1214, -292, -374], [2304, -816, -137, -992, -1483, 110], [-8336, 172, -2599, -505, 1154, 497], [12258, -780, 132, -1361, -104, -212], [6705, -405, 2232, 167, -1334, -142], [13703, -973, -260, -1102, -198, -736], [1270, -136, 3585, -1379, -802, 218], [7136, -904, -1295, 386, -494, -1256], [-4426, 394, -1486, -2298, 106, 90], [-2554, 248, 516, 1952, -558, 120], [-5525, 439, 1595, -322, 1152, -492], [-2846, 282, -2710, -790, 686, 494], [4388, 44, -3248, 534, -72, 622], [6200, -1044, 66, 106, -582, -374], [7502, 154, 1062, 1422, 1362, -696], [7087, -471, 4604, -306, 397, 268], [-9118, 200, -1842, -334, -1134, 498], [-1181, -109, 579, 2825, -629, -210], [7053, 277, 2838, -1200, -1102, 806], [6180, 792, -1755, -1904, -537, 446], [-8238, 1016, -656, 1150, 2134, -302], [19780, 676, 2749, -1255, -602, -19], [-10352, -1280, 1677, -612, -1694, -764], [3724, 1086, 2969, -2052, 245, -518], [1135, -211, 1106, -135, -812, 586], [18088, 496, -596, 1908, 1112, 1066], [4741, 861, 466, 546, 1364, -550], [-25179, -1827, 1496, -544, -655, -608], [-2038, 396, -5506, 147, 48, -184], [-14813, 9, 3988, 1650, 647, -10], [-17481, -169, -1001, -301, 1872, -882], [-4521, -519, 6637, 1131, -339, 951], [-8885, 1351, 664, -2536, -183, 612], [8463, -211, -5148, 1889, -614, 746], [8661, -683, 1673, 576, 322, -146], [23534, 62, 347, 87, -514, -943], [7581, -751, -4476, 2745, -1100, 297], [309, 619, -332, 2752, 833, -156], [-24722, 1236, 2480, 1464, 225, -194], [-8742, -1802, 1878, 186, -1074, 446], [-8024, -564, -3031, -1073, -1385, -1488], [434, 148, -1413, 2034, -427, 414], [-16473, -857, -1915, 563, -549, -1254], [-12474, 1058, 61, 1280, 949, 42], [-11907, -191, 3105, -2567, 330, -750], [20969, -315, -1400, -1776, -531, -404], [5975, -591, 1206, -364, 620, 992], [-7624, 90, 3188, 394, -1296, 652], [-24920, 920, -5128, 2238, 548, -248], [-16559, 1233, -4155, 472, -14, 522], [15083, -447, 452, 2116, 537, -32], [11360, 1364, -2089, 582, -823, 1116], [4199, 407, -4865, -485, 1272, 82], [-23935, -1757, -1345, 1233, -937, 769], [-11395, -171, -2331, -1234, 1900, -2002], [-14460, -394, -6734, 876, -762, 1132], [5227, -181, 2064, -3023, -1858, 1245], [-11482, -88, 4307, 265, -1546, 1244], [5057, -65, 1354, 1038, -1147, 1114], [-19192, 46, -1866, 3650, 210, -34], [3263, 817, 1164, -1330, 723, 738], [-10491, -167, -4711, 2689, 872, 64], [2195, 691, -4265, 1075, 737, 852], [-10442, 66, -2195, -1192, 184, 16], [-6600, -1842, 986, 1649, -1138, 638], [8505, -1717, -4252, -19, -72, -986], [-20663, 155, 2420, 312, 725, 478], [-22788, 1246, -5960, 2906, 1374, 336], [10783, 1417, 1970, -3712, 1546, 1100], [5872, -1014, -3748, 1950, 778, -1866], [-814, 1108, 5044, -3931, 726, 264], [10352, 640, 3303, -2072, -667, 6], [645, -189, -2948, -222, 554, -384], [-35422, 414, 2806, -4170, -1578, -1100], [-36213, -377, -3723, -2538, -916, -452], [-16846, 1110, -5453, -203, -164, 427], [-7971, 49, 879, 2559, 141, -538], [-27452, -1460, 3978, -1782, 1028, -1272], [6268, 1602, 969, 1550, -271, 1506], [4041, -363, 7342, -3182, 1115, -1218], [-24912, -512, 5430, 384, 2902, -622], [9621, -571, -158, -2251, 418, 833], [8256, 488, 4635, 2354, -1613, 600], [8840, 84, -4345, 2549, 1213, 78], [-29410, 504, 10516, 584, -162, 628], [-1672, 218, 3668, 2804, -850, 1802], [-44964, 1412, 3182, -854, 1268, 186], [47009, 1071, 1650, 1036, -557, -832], [-10258, -2210, -2293, 4813, -858, -639], [-28935, -35, 40, 2263, -1262, 1471], [-37099, -121, -1671, 1687, -396, 84], [4759, 185, 3692, -3662, -1171, 496], [3450, -1488, -3946, -2088, 698, 840], [-20832, -1288, -3073, 4144, -2364, -412], [-10190, -826, -1422, -1796, 180, 1078], [10895, -1437, -2583, -576, -1850, -1948], [15772, 994, -52, 5160, 238, 1652], [-13708, 2520, -3123, -238, -465, 1124], [-30707, 1247, 6600, 925, 1062, 874], [-18560, 188, 3845, -2014, 31, -1848], [35488, 284, 4085, 1801, -997, -1540], [19742, 1374, -2165, -2171, 828, 1762], [-9609, -1041, -904, 1619, 3082, 25], [-45317, -581, 6787, 1927, 433, 182], [19895, 913, -1516, 160, 2777, 1732], [-15262, -574, -4253, 1313, -1288, -1742], [-33663, -905, 1924, 3618, -2058, 2388], [1366, 1606, -3052, 166, 3020, 290], [14662, -662, 4492, 662, 1816, 454], [6774, 3304, -1778, -1232, 1680, 1402], [31732, -1246, 5779, -5, -902, -2894], [3198, -2310, -1969, -2010, -1831, -2654], [-23344, -790, 510, -214, 1578, 774], [-7997, -449, -4560, 4592, -722, -758], [-1321, 1597, 4440, -4796, 797, 1336], [25183, 2199, 2255, -3649, 1065, -355], [27228, 992, 7081, -5707, 2193, -270], [50636, 1074, 1714, 1, -1782, -366], [-4784, 1630, 2345, -4279, 1764, 2016], [-23275, -2149, -639, -2007, -9, 1295], [53045, 367, 300, -1198, -1897, 812], [-18746, -980, -4794, -1806, 737, -1538], [-20541, 1287, 1470, 3718, -798, -874], [59438, 1204, -1152, 4140, 818, 2882], [-7893, -2155, 900, 3078, -1306, 3536], [21379, -813, -9968, 2241, 960, -281], [-28243, 2013, 8829, -2408, -430, -274], [-4043, 183, 7657, -3705, 811, -1209], [14607, -1185, 1346, -2538, -291, -454], [-7496, -3698, 1262, -2019, 136, -824], [-14704, 1548, -5251, -2790, 2671, -952], [-246, -1640, -1746, 222, -708, 2152], [20639, 281, 6766, 756, -1133, 2160], [-17558, -3396, 11141, 59, -1406, -282], [41107, 2257, -3392, 2867, 482, 190], [12308, 1136, -2447, -6934, 1333, -356], [8336, 654, -5172, -3988, 836, 630], [6104, 2658, -856, -772, 764, 1910], [49614, -1914, -5807, -853, -1105, -2970], [22583, 217, 6654, 4780, -3771, 370], [-32018, 458, 393, 40, 929, 1764], [19912, 1080, -5382, 4196, 880, 632], [2387, -129, 1192, 1370, 252, 734], [63384, -1564, -4649, -2589, -2513, 694], [-22738, 130, -10443, -792, 3369, 2280], [-26801, -1517, -6927, 765, -2007, -189], [68541, -1743, -1184, -1282, -707, 420], [-40939, 2239, 8712, 2373, -36, 870], [1070, 2928, 2413, 3221, 320, -1598], [39499, 123, -2292, 7763, 402, 1545], [2823, 281, 14090, -416, -3680, -16], [12574, -828, -3272, 286, -1916, 3010], [-21653, 321, -1599, -4743, 1238, -1238], [-37335, 3069, -11692, 2434, -619, -84], [-16320, -1334, -842, -3592, 1091, -506], [8845, 1535, 6796, -1887, 3070, -3282], [24658, -1420, 1720, -879, 636, -1822], [50778, -1806, 7049, -1627, -4381, -318], [-7474, 310, 7243, -1263, 865, 1882], [-51148, -3454, 4695, 2751, 644, -188], [19113, -1035, -1810, 4802, 125, 1400], [-23204, -52, -2485, -2701, -1212, -507], [48932, 432, -578, -2110, -2458, 1370], [6068, 624, -9197, 2116, 4703, -30], [13347, -1849, -5004, 1109, 1546, -5083], [-45872, -2524, -8481, 2464, -875, 1526], [-19720, 2014, 7554, -499, 550, 3030], [-64426, 1890, -3978, 3310, 1562, -2098], [16471, 3383, -5582, -790, 3829, 812], [-14855, -1977, 6198, 2950, -2007, -948], [2496, -1746, -1830, -5826, -848, 688], [19100, -3202, -9450, 5670, -3046, -100], [-40070, 1522, 12891, -1898, 241, -48], [74096, 1680, 713, 4345, -828, 1459], [-21889, 1111, 7197, 353, 3489, -1026], [6688, 2472, -9673, -2358, 2468, 2096], [-7046, 4886, -2620, 4830, 3384, 1282], [-123996, 2678, 9690, -522, -882, 2056], [59266, -712, -5238, 1290, -2544, -1568], [11860, -3944, -1465, -3683, 1723, -6668], [45942, 3436, 3449, 732, 5015, -3274], [-1292, -2354, -8044, 5416, -3901, -732], [-20076, -4556, 10529, 3248, 323, -1110], [-85514, -748, 1920, 2840, -1138, 1978], [-48305, 635, 12395, 172, -20, 1450], [-18096, 876, -20645, -772, 819, 54], [7658, -154, 9677, -6404, 3144, 756], [-22289, -1215, -9811, -1097, 3, 1493], [6420, 594, -18292, -2962, 174, -238], [-3281, 1327, -17996, 6612, -2473, 2892], [-18033, 3839, -537, -3889, -183, 965], [-61053, 1805, -230, -4050, -2367, 3310], [39998, -1546, 13835, -2533, -857, -2876], [4066, 2266, -5493, 1099, -1154, 1693], [28388, 1572, -16693, -2660, 76, -376], [-71279, 357, -10792, -7569, -906, 1875], [64407, -2337, 683, 4115, 1673, -1618], [-71203, 2677, 5701, 1034, -1672, 3330], [40114, 5862, 1012, -3580, 3732, 4120], [-17132, 242, -1331, 24, 3365, -1554], [24143, -933, 17790, -3437, 2530, -769], [27332, -1490, -18210, 5764, -2565, 2312], [12244, -1364, 13523, 384, -7723, 1566], [-70636, -1782, -4039, 3294, 297, -1862], [72341, 255, 5770, 228, -2869, -3918], [-25298, -1912, -3254, 3503, -1592, -1112], [-9658, -722, -23859, 2842, -2295, 1856], [-9063, -2809, -5906, 8844, -1153, -2798], [86062, 552, -3452, -3391, 1138, -3240], [-36188, 336, 11761, 303, 415, -624], [-82531, -923, -2202, 799, 6584, -2049], [-19188, 506, 1260, 988, -2678, -940], [39979, 2653, -8028, -5032, -1083, 2558], [-32556, 1450, -8430, 316, 6812, -728], [-57453, -1077, 9089, 3015, -4189, 3982], [-23909, -1279, -17956, 3093, 3042, 3714], [65227, 5161, -14617, -1363, 3512, 1508], [84451, 1071, 11408, 3308, 2233, -4262], [-22652, 4860, -205, -1442, 899, 5464], [-11550, -932, -2876, 2044, 5472, 1660], [34579, 3819, 5267, -3309, 121, -1254], [8194, 1062, -10239, 282, -3749, 2800], [-19281, 4557, -11521, 2023, -1805, 2303], [45350, -4038, 5997, 1680, 404, -4084], [-30229, -3137, -12082, 4589, -2988, -3771], [50464, -934, -4242, 3760, -1593, -1120], [5377, 15, -5200, 4030, 5769, -850], [-19449, 1539, -5396, 1260, -3297, 5616], [18354, -2462, -6077, 3462, 1435, -1568], [-37999, 3287, -15866, -3416, -328, 564], [28400, -5696, 10450, -5582, 900, -5666], [-44999, 2301, 1442, -2398, 861, 3702], [-2331, -5261, -3358, -7872, -4801, 1134], [-8715, 945, 9152, -749, -3808, -1123], [6441, 1223, 10258, 3732, -3150, 7884], [19910, 4586, 15543, -5041, 6216, 223], [-86322, 912, -15437, -2791, 598, 1694], [116767, -353, 15109, -1057, -1271, 3492], [15252, -3054, 10007, -4625, -5620, 1262], [41681, 765, -14177, -10457, 3394, -2022], [21497, 3121, 17072, -9451, 1816, 1561], [-20142, 2622, 977, 7181, 3846, 1183], [9511, -3445, 1792, -974, -577, -1040], [-26743, 2267, 19771, -3037, -5318, 3918], [8763, 3897, 12388, -9037, 3282, -3426], [98050, 3854, 5522, -7302, -2626, 2494], [-48360, -1018, -17580, 5235, -950, 3200], [70540, 224, 14056, -1610, -4444, 5284], [-14279, 1539, 6398, -9319, 3710, -5722], [36445, 6133, 7934, -3235, 4030, 3905], [33450, 764, 1474, 2079, 5950, 4622], [-101748, 1872, -14417, 6022, 129, 1960], [42206, 2714, -16257, -2678, -3366, 0], [16634, -1050, -3815, -1294, -1813, 6192], [-34528, -5470, -7132, 11188, -7470, -4482], [-5330, -662, -8476, -3512, 1068, -4472], [-39984, -1670, -18552, 6172, 1232, -1142], [2086, -3010, -6476, 3560, -6636, -6652], [18473, -19, -6340, -3600, 301, 2882], [-47684, -3426, -6226, -2034, -1293, -5090], [18942, -500, 10805, 5176, 2643, 3050], [11288, 2232, 12424, -3824, 160, -240], [47744, -2870, -18684, 888, -1516, 1002], [-45785, -3245, -9914, 4542, -4944, 6084], [-35519, 1511, -1212, -11668, 1423, -12], [24482, -3596, -6312, -13620, 2232, 1100], [86819, -3313, -18426, -2274, 3587, -2734], [35981, 3787, -11962, 2928, 3444, -1440], [56712, 200, 11905, 2628, 40, 2876], [-10341, 4211, 24615, -8523, 4207, -46], [-82814, 1244, 9362, -11492, 2726, -5362], [9444, -2952, 15774, 2898, -4732, -4350], [21655, -2051, 19511, -4257, -1621, -1437], [-18527, -2911, 17576, 3546, -3363, -2922], [17396, 7602, -2754, -2671, -36, 4916], [15118, -3518, 1852, 2192, -8566, 1884], [175681, 395, -1208, -2357, 174, 434], [34826, 2728, 17780, 4900, 2826, 2214], [56646, 4818, -7034, 3228, -2516, 1792], [-15342, -2676, -5031, -5434, 3695, -3122], [33021, -723, -1772, -348, -6648, -838], [25132, 460, 15962, -5718, 1468, -4148], [77052, -2872, 16115, 1059, -499, 2834], [-101454, -1800, -4492, -4304, 1262, 3074], [-49802, 5992, 1334, 1643, 150, 5606], [-58520, 1444, -18541, -248, 5659, -694], [37252, -4514, -1614, 68, 1672, -2226], [3022, -2894, 2801, -5136, -2026, -2468], [-12471, -1449, -1840, 1016, -4581, 7806]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_616_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_616_4_a_h();".
// 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_616_4_a_h(:prec:=6)
    chi := MakeCharacter_616_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_616_4_a_h();".
// 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_616_4_a_h( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_616_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,4,sign)));
    Vf := Kernel([<3,R![-2800, -2200, 2000, 10, -95, 0, 1]>,<5,R![-333648, 137056, 12768, -3864, -299, 14, 1]>],Snew);
    return Vf;
end function;